CProgramming (Lab1)
CProgramming (Lab1)
Lab Exercise 1
1. Write a program which displays: This is the first programming lab exercise.
*
* * *
* * * * *
* * *
*
6. Write a program find to addition, subtraction, multiplication and division of two numbers
entered by the user.
9. The length and breadth are input through the keyboard. Write a program to calculate the
area and perimeter of the rectangle.
10.Write a program to divide one integer by another integer and find the quotient and
remainder.
13. Write a program to convert entered number of days into years, months and days.
15. Write a program to input two digit numbers and reverse the number.
16. Write a program to input two numbers from the keyboard and interchange the contents of
the two variable.
17. Write a program that takes input from the user by using getchar( ) function and prints it
on the screen by using putchar( ) function.
18. Write a program that takes text from the user by using gets( ) function and print that text
n the screen using puts( ) function.
19. If the marks obtained by a student in five different subjects are input through the
keyboard, find out the aggregate marks and percentage marks obtained by the student.
Assume that the maximum marks obtained by a student in each subject are 100.
20. Write a program that will convert temperature in Centigrade into Fahrenheit.
[Hint: C=5/9(F-32) and F=9/5C+32]
21. Write a program that asks three coefficients of a quadratic equation and calculate its root.
22. Write a program to read three sides of a triangle and calculate the area.
[Hint: Area=√s(s-a)(s-b)(s-c)]
23. Two numbers are input through the keyboard. Write a program to interchange the
the contents.
25. If a five-digit number is entered through the keyboard, write a program to calculate the
the sum of its digits.
26. If a five digit number is entered through the keyboard. Write a program to reverse the
number.
27. If a four digit number is entered through the keyboard. Write a program to find the sum
of first and last digit of this number.