C Programming Lab Manual
C Programming Lab Manual
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.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%
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.1 Read 10 integer numbers and find Sum of first 10 integer nos .
3.7 To find sum of odd value and even value digits of a given number.
3.8 1-2+3-4…….N terms
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)
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.9 Write a menu based program : Enter a string and perform following operations
1.Encrypt
2.decrypt
3.quit