Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

B.

Tech (Practical – Programming in C)

The students are required to perform the following programs in lab and also submit the
code and the outputs as hard copy in a file.

1. Write a program in C to print the first 10 natural numbers. Also, take a variable to store the sum
of these numbers and display the result. Perform using for loop and while loop.
2. Write a program to enter 10 numbers from the users. Take three different variables to store the
result of sum, average and product of these numbers and display the result.
3. Write a program to take an input number from the user, and using if-else construct check if a
number is even or odd.
4. Write a program to enter a number and using if-else construct check if a number is prime or not.
5. Write a program to input two numbers from the user and swap the values of two variables using a
third variable. Display the values of variables before and after swapping.
6. Write a program to input two numbers from the user and swap the values of two variables without
using a third variable.
7. Write a program to check whether a given year entered by user is leap year or not. (Note: A leap
year is exactly divisible by 4 except for century years. The century year is a leap year only if it is
perfectly divisible by 400.)
8. Write a program to get a number input from the user and find the sum of digits of the number
(Note: if the number entered by the user is 198, then the sum should be 1+9+8 i.e., 18).
9. Accept values for sides of rectangle and radius of circle from the user. Write a program to find
the perimeter and area of a rectangle and a circle. (given the side of rectangle and radius of circle)
10. Write a program to print Fibonacci series up to n numbers (Note: The Fibonacci numbers are the
numbers in the following integer sequence. 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ……..)
11. Write a program to print the following patterns :-

a) * b) *
** **
*** ***
** ****
* ***
**
*
12. Write a program to print the table of a given number.
13. Write a program to implement calculator using switch case. This program takes an arithmetic
operator +, -, *, / and two operands from the user. Then, it performs the calculation on the two
operands depending upon the operator entered by the user.
14. Write a program to input two numbers from the user. Make a user defined function to swap those
numbers using call by reference.
15. Write a program to find the decimal equivalent of a input binary number and vice versa.
16. Write a program to demonstrate recursion in finding the factorial of a given input number. Use
functions with parameters and return value.
17. Enter a 1D array from the user. Creating a user defined function to search a number entered by
the user in the entered array. Also, return the index of the element if the element is found. (Linear
Search)
18. Write a program to sort the list of 10 elements using bubble sort method.
19. Write a program to enter two strings from the user and concatenate the strings without using any
string function.
20. Write a program to enter two 2D matrices [3X3] from the user and print the matrix multiplication
of these 2-D matrices .
21. Write a program to enter a 3x3 matrix from the user. Check whether all the elements entered are
positive or not. Display the number of positive and negative numbers. Calculate the sum of all the
positive elements only of the matrix. Use (continue statement)
22. Write a program to check if a string is a palindrome without using built-in function
23. Write a program to enter the details of employees of an organization using a structure and display
the details of the highest paid employee of the organization.
24. Write a program to count the number of words and characters in a file.
25. Write a program C Program to convert the content of file to upper case.

You might also like