0% found this document useful (0 votes)
6 views

C Programming Lab Manual

Uploaded by

samirkham78692
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

C Programming Lab Manual

Uploaded by

samirkham78692
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

SARDAR PATEL UNIVERSITY

Vallabh Vidyanagar
Bachelor of Computer Application
Semester – I Lab Manual
US01CBCA22 : Programming Fundamental Using C Lab
(w.e.f June 2018)
Credits : 2
Contact Hrs per week : 4
1 Programs based on Basic Logic
1.1 Write a program to read 5 integer numbers and Calculate and Print Average of 5 given
no’s.
1.2 To find simple interest. Hint: SI = (P * R * N)/100
1.3 To find area of circle (a=∏r2 where ∏=3.14)
1.4 Write a program to swap two numbers using third variable.
1.5 To read customer number, customer name, past meter reading, present meter reading,
charge per unit. Calculate bill amount and print all the information.
1.6 To display following output :
*********************************************************
* Roll No: _____________ *
* Name: _____________ *
* Class: _____________ *
********************************************************
2 Programs Based on if statement

2.1 To check whether given number is odd or even.

2.2 To check whether given number is positive, negative or zero.

2.3 To find maximum number from given three numbers.

2.4 Write C Program that read a number and checks weather the given no. is divisible by X
or not. (X is any no. entered from user)
2.5 Write a program to read two operands and one arithmetic operator and perform the
operation according to it using switch statement.
2.6 Input an integer number. Check & print the message Number is one digit, two digit
…..Five digit.
2.7 Input month number and print corresponding month name.

2.8 An electric power distribution company charges its domestic consumers as follows:
Consumption Units Rate of Charge
1-100 Rs. 0.75 per unit
101-300 Rs. 75 plus Rs. 1.00 per unit excess of 100
301-500 Rs. 275 plus Rs. 1.50 per unit excess of
300
500 and above Rs. 575 plus Rs. 1.75 per unit excess of
500

Write a program that read customer number & power consumed and print the amount
to be paid by the customer. Note that output should be well formatted.
2.9 Write a program to find net salary of employee. Criteria to calculate net salary are as
follows:

Employee DA MA PF IT
code
1 to 5 67% 12% 10% 15%
6 to 12 62% 10% 9% 10%
13 to 15 55% 8% 8% 8%

DA, MA, PF and IT are given in percentage of basic salary.


Net salary = Basic salary + DA + MA – PF – IT
2.10 To read student roll number, name and marks of 3 subjects. Calculate total, percentage
class and result according to criteria. (Use flushall)

If student fails in one or two subjects then declare result as “ATKT” and class as ****
If student fails in more than two subjects then declare result as “FAIL” and class as ****
If student passes all subjects then declare result as “PASS” and find class according to
following criteria.
If percentage is >=70 then class is distinction.
If percentage is >=60 then class is First class.
If percentage is >=50 then class is Second class.
If percentage is >=40 then class is Pass class.

3 Programs based on Loops

3.1 Read 10 integer numbers and find Sum of first 10 integer nos .

3.2 To find out N! (Factorial of N).

3.3 Read x and y and print value of XY. (Power)

3.4 To print N terms of Fibonacci series.


Input: N=9
Output: Fibonacci series: 1 1 2 3 5 8 13 21
3.5 Read an integer no and print Reverse of the given number

3.6 To check whether inputted number is palindrome number or not.

3.7 To find sum of odd value and even value digits of a given number.
3.8 1-2+3-4…….N terms

3.9 x + x2/2! + x3/3! + x4/4!……..xn/n!

3.10 To print the following pattern for n=4.


1
1 2
1 2 3
1 2 3 4
3.11 To print the following pattern for n=4.
1
1 2
1 2 3
1 2 3 4
3.12 To print the following pattern for n=4.(n in range 1 to 10)
A
A B A
A B C B A
A B C D C B A

4 Programs Based on Array

4.1 Input n elements in an array and find sum of all elements of array.(1D)

4.2 Find out the maximum and minimum element from one dimensional array.

4.3 Read n elements into one dimensional array and Sort the elements in ascending order.

4.4 Read n elements into one dimensional array and find Frequency of each element.

4.5 Enter two matrix A and B. create a new matrix C which stores all elements of matrix A
first, then all elements of marix B.
4.6 To read two matrix A and B and perform matrix addition. (A & B both mxn matrix)

4.7 Read a matrix and display the Transpose Matrix

4.8 Read a matrix and check whether it is Identity Matrix or not.

5 Programs Based on String

5.1 Input string from user and find out Length of string without using strlen Function
5.2 Input string from user and find out Length of string using strlen Function

5.3 Input two strings from user. Add second string at the end of first string without using
strcat function.
5.4 Input two strings from user. Add second string at the end of first string using strcat
function
5.5 To count and display the total number of Uppercase, Lowercase, digit, blank space and
special character from a given string.
5.6 Convert string into upper case and vice versa

5.7 To Reverse a given string with without using strrev

5.8 To Reverse a given string with using strrev

5.9 Write a menu based program : Enter a string and perform following operations
1.Encrypt
2.decrypt
3.quit

Write algorithm and draw flowchart for following definitions:


(This algo./flowchart definitions must also be covered in the classroom…Can be
asked in theory paper)

1. To find simple interest. Hint: SI = (P * R * N)/100


2. To find maximum of given three numbers.
3. To check whether given number is odd or even
4. To find out minimum from N numbers.
5. To find out N! (Factorial of N).
6. To check whether inputted number is prime number or not.
7. To check whether inputted number is reverse number or not.
8. To find sum of odd value and even value digits of a given number.
9. To print N terms of Fibonacci series.
Input: N=9
Output: Fibonacci series: 1 1 2 3 5 8 13 21
10. sum=12 + 22 + 32 + 42 + 52 + 62 + 72 + … and so on.

Paper Style for External Exam [Total Marks 50]

Q1. Basic Logic Programs [10 marks]


Q2. Program other than Basic [15 marks]
Q3. Program other than Basic [15 marks]
Q4. Viva [5 marks]
Q5. Journal [5 marks]

You might also like