You are on page 1of 1

Labsheet2: Operators & Basic I/O Function

1. Write a program to display "This is my first program in C."


2. Write a program reads any two integers from user then calculate and display
sum, difference, product, quotient and remainder.
3. Write a program to calculate and display square and square root of the given
number.
4. Write a program to calculate and display simple interest and amount.
5. Write a program to swap two numbers with or without using third variable.
6. Write a program to convert the temperature given in degree Fahrenheit into
degree Celsius. [Hints: F = 1.8C+32]
7. Write a program to calculate and display area and circumference of a circle.
8. Write a program which reads length of three sides of a triangle and calculate the
a+b+ c
area. Area = √ s(s−a)(s−b)( s−c) where s = 2
9. Write a program to find the length of the hypotenuse of the right angled triangle
if the base and perpendicular are given.
10. Write a program to find the size of int, float, double and char.
11. Write a program which reads the cost of a book in 'Paisa' and converts it into
'Rupees' and 'Paisa'.
12. Write a program to find the sum of first and last digits present in the given
integer. [Hints: use / and % operators and when n=1234 then sum=5]
13. Write a program which reads a four digit number and returns a number which
is the sum of the first two digits and the last two digits. For example, an input of
1234 should return 12 + 34 = 46.
14. Write a program which reads time in second and converts it into hh:mm:ss
format. [Hints: when you input 3672 second then output must be 3672 Seconds =
1 Hour. : 1 Minute : 12 Seconds]
15. Write a program to convert the Cartesian coordinates to Polar coordinates.
[Hints: Cartesian coordinate is written in terms of (x, y) and Polar coordinate is
y −1
written in terms of (radius, angle), where radius=√ x 2 + y 2 and angle =tan
]
x
16. Write a program that accepts a character from the keyboard and displays it on
the console. [Use getchar and putchar I/O function.]
17. Write a program that accepts name and address of a person from the keyboard
and displays it on the console. [Use gets and puts I/O function]
18. Write a program to display ASCII code of a character given by the user.

You might also like