Problem Solving using C Lab (Code:2201)
Part-A
(First program in question paper, only for write up, carries 20 Marks)
1. Write a C program to check whether a given number is prime or not.
2. Write a C program to find the greatest among three students cgpa (float value) entered
by a teacher.
3. Write a C program to check whether a given number is even or odd using the conditional
(ternary) operator
4. Write a C program to generate the multiplication table for a given number.
5. Write a C program to count the number of digits in a given integer using a while loop.
6. Write a C program to find the square of a number using a macro.
7. Write a C program to check whether the given number is palindrome or not.
8. Write a C program to read a number and count how many even digits it contains.
9. Write a C program to find the sum of first N natural numbers.
10. Write a C program to check whether a given number is positive, negative or zero using
nested if.
11. Write a C program to find the factorial of a number using iteration.
12. Write a C program to smallest among given 3 numbers using logical operator &&
(AND)
13. Write a C program to count the number of vowels in a given string.
14. Write a C program to swap two numbers using call by value.
15. Write a C program to swap two numbers using call by address / reference
Part-B
Second program in question paper, for write up & execution, carries 30 Marks
[write up: 20M, execution: 10M]
1. Write a C program to store the details of five library books (book ID, title, and price)
in a file, and display all the stored records using fprintf() and fscanf().
2. Write a C program to store details (such as roll number, name, and marks) of 5
students using array of structures and display all students’ details.
3. Write a C program to store 5 integer values in a file and display them using putw()
and getw() functions
4. Write a C program to store 3 employee details (emp_id, ename, salary and tax) in a
file and display all stored records using fprintf() and fscanf().
Hint : tax = 5% of salary
5. Write a C program read and print array elements, also search for a given element in an
array using the linear search technique.
6. Write a C program to read n numbers sort numbers using the Bubble Sort technique.
Also display the sorted list.
7. Write a C program read n number sort numbers using the Selection Sort technique.
Also display the sorted list.
8. Write a C program to store the details of three students (roll number, name, total, and
average) in a file, and display all the stored records using fprintf() and fscanf().
Hint : average = total / 3
9. Write a C program to store text in a file character by character, then read the file and
display its contents using the putc() and getc() functions.
10. Write a C program to store a list of numbers in a file using putw(), and then read and
display the file contents using getw(). Also, count and display the number of even and
odd numbers in the file.
11. Develop a C program to manage electricity details of five BESCOM customers by
storing meter number, previous and current readings, and units consumed using an
array of structures, and display the stored information.
12. Write a C program to pass an entire array as a parameter to a function and calculate
the average of its elements using the function. Also, display the array elements and
the calculated average.
13. Write a program to read n elements into an array and display them. Also, search for a
key element and count the number of occurrences.
14. Write a C program to perform the addition of two matrices. Also display the given
matrices and the resulting sum matrix.
15. Write a C program that accepts the number of elements, creates a dynamic array to store
float values, reads and displays the elements, and finds the smallest value.
((((( Best of Luck )))))