C Lab Manual
C Lab Manual
1. Write the algorithm and draw the flowchart to a) find area of a circle. b) find the area of a triangle.
2. Write the algorithm and draw the flowchart to convert temperature in Fahrenheit to centigrade using the
formula C=(F-32)5/9
3. Write the algorithm and draw the flowchart to calculate simple interest.
4. Write a program to calculate the electricity charges giving the following information:current reading,previous
reading,take the charge as 1.50 per unit.
5. Write a program to find swapping of two numbers.
6. Write a program to calculate roots of quadratic equation
1. Write a program to read a character from the user and display it.
2. Write a program that reads a character and prints its ASCII value.
3. Write a program to input your full name and age, then display it in a formatted manner
4. Write a program to print a floating-point number with two decimal places.
LOOPING
1. Write a program to find out the biggest of three numbers using nested if.
2. Write a program to print n-even numbers using a loop.
3. Write a program to print the sum of n-numbers.
4. Write a program for the Fibonacci Series.
ARRAY
1. Write a C program that declares a one-dimensional array of n elements, takes input from the user, and
calculates the sum and average of the elements.
2. Write a C program to add two 2x2 matrices. Initialize the matrices and display the result of their addition.
3. Write a C program that reads a 3x3 matrix from the user and prints its transpose. The transpose of a matrix is
obtained by swapping its rows and columns.
4. Write a C program to multiply two matrices, where each matrix can be of size m x n and n x p respectively.
The program should take the matrix dimensions and elements as input from the user and output the
resulting matrix.
FUNCTIONS
1. Write a C program to create a function that takes two integer parameters, adds them, and returns the sum.
The main function should call this function and display the result.
2. Write a C program to create a function that returns the square of a number. The main function should call
this function and display the result.
3. Write a C program that uses a recursive function to calculate the factorial of a number. The function should
return the factorial value to the main function, which will print the result.
4. Write a C program to create a function that takes three integer numbers and returns the largest one. The
main function should call this function and print the largest number
Structures
1. Write a C program to define a structure to store information about a book, including the title, author, and
price. Assign values to the members and print the information.
2. Write a C program to define a structure Employee with members id, name, and salary. Then, create an
array of 5 Employee structures and input the values for each employee. After that, print the details of
each employee.
3. Write a C program to define a structure Student which contains an array of 5 integers representing
marks of subjects. Accept the marks for each subject and calculate the total and average marks.