01 Basic
01 Basic
You have to take as input , and in order. Can you figure out the data types for all the
variables?
Sample input Sample output
5 6 12 v = 77
8. Write a C program which will calculate the displacement of a moving body by using the
following equation:
You have to take as input , and in order. Have you faced any problem regarding the
output?
Sample input Sample output
5 6 12 s = 492
9. Write a C program which will take as input the height of an object in centimeters, and
represent it in meter-centimeter format.
Sample input Sample output
157 1 meter 57 centimeter
2309 23 meter 9 centimeter
10. Write a C program which will take as input the height of an object in inches, and
represent it in feet-inch format.
Sample input Sample output
57 4 feet 9 inch
79 6 feet 7 inch
11. Write a C program which will take as input a time interval in seconds, and represent it in
hour-minute-second format.
Sample input Sample output
3824 1 hour 3 minute 44 second
525 0 hour 8 minute 45 second
12. Suppose that in a country, there are notes of 1, 5, 10, 50, 100 and 500 units of currencies.
Write a C program which will take as input the amount of money to give, and find out the
number of each note to provide this amount of money so that a minimal number of notes
are given in total.
Sample input Sample output
1627 3 note(s) of 500
1 note(s) of 100
0 note(s) of 50
2 note(s) of 10
1 note(s) of 5
2 note(s) of 1
789 1 note(s) of 500
2 note(s) of 100
1 note(s) of 50
3 note(s) of 10
1 note(s) of 5
4 note(s) of 1
The math.h header
1. Write a C program that will take as input a floating-point number, and print the floor and
the ceiling of that number.
Sample input Sample output
5.7 Floor = 5
Ceiling = 6
-5.7 Floor = -6
Ceiling = -5
2. Write a C program that will take as input two floating point numbers and , and print
the value of .
Sample input Sample output
34 81.00
5.2 1.5 11.85
3. Write a C program that will take as input an angle in radian, and calculate the sine, the
cosine and the tangent of the angle.
Sample input Sample output
1 Sine = 0.84
Cosine = 0.54
Tangent = 1.55
0.524 Sine = 0.50
Cosine = 0.86
Tangent = 0.57
4. Write a C program that will calculate the terminal velocity of a moving body by using the
following equation:
You have to take as input the values of , and in order, and output the value of (not
).
Sample input Sample output
5 6 20 v = 16.27
5. Write a C program that will solve the following quadratic equation:
You have to take as input the values of , and in order. The solutions can be
calculated by the following equation: