Assignment-I
Assignment-I
Assignment – I
1. Write a C program that reads two values from the keyboard, swaps their values and prints out the result.
2. The length and breadth of a rectangle and radius of a circle are input through the keyboard. Write a
program to calculate the area and perimeter of the rectangle, and the area and circumference of the
circle.
3. If a three-digit integer is input through the keyboard, write a program to calculate the sum of its digits.
(Hint: Use the modulo operator ‘%’)
4. An integer is entered as an input through the keyboard. Write a program to find out whether it is an odd
number or an even number.
5. Input two integer numbers and divide the larger number by the smaller one. Then display the result using
printf() function as a fractional number first and then as a real valued number. (Example: 9 divided by 5
shall yield “ 4/5” and “1.8” respectively. )
7. Accept three integer numbers and find their average. Next display which numbers are below and above
the average value.
8. Temperature of a city in Fahrenheit degrees is input through the keyboard. Write a program to convert
this temperature into Centigrade degrees.
9. Write a C program which accepts basic salary as input and prints the gross salary, which is sum of the
basic, dearness allowance (60% of basic salary), and house rent allowance (15% of basic salary).
10. A cashier has currency notes of denominations 10, 50 and 100. Write a C program which accepts an
amount to be withdrawn, and prints the total number of currency notes of each denomination the cashier
will have to give to the withdrawer. [OPTIONAL]
11. 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 that
can be obtained by a student in each subject is 100. Input error should be checked. [OPTIONAL]
12. The length and breadth of a rectangle are input through the keyboard. Write a programme to determine
(i) radius of a circle and ratio of perimeters of the rectangle and the circle if the areas of the rectangle
and the circle are equal (ii) radius of the circle and the ratio of the areas of the rectangle and the circle if
the perimeters of the rectangle and the circle are equal. [OPTIONAL]