(Do Not Use Loop Structure) : Assignment On 01.08.17
(Do Not Use Loop Structure) : Assignment On 01.08.17
17
(Do not use loop structure)
1. Write a program that prints the decimal part of a given float separately.
2. Write a program that deletes second last digit after decimal.
3. Write a program that deletes first digit after decimal.
4. Write a program that exchange digits before and after decimal.
5. Write program to exchange last two digits. e.g. input 23617 output 23671. input
27845345 output 27845354.
6. Write program to exchange the last and the third last digit. e.g. input 23617 output 23716.
input 27845345 output 27845543.
7. Read a number. Find product after deleting last and second last digit. Input 4358 output
190530 (438*435).
8. Read two numbers. Find their product after exchanging last digits. Input 4270 and 153
output 640950 (4273x150). Input 348 and 31 output 12958 (341*38).
9. Write a program to check whether a given number is divisible by 7 or 9.
10. Write a program to check whether given two numbers are equal or greater or less than the
other.
11. Write a C program to print the number entered by user only if the number entered is
positive, negative or zero.
12. Write a program to check whether the entered year is leap year or not.
13. Write a program that prompts the user for the lengths of two legs of a right angle triangle
and makes use of the pow and sqrt functions to compute the length of the hypotenuse
using the Pythagorean theorem.
14. Take a straight line ax+by+c=0 and take a circle with center (p,q) and with specific radius
r. Check whether the line intersects the circle or not.
15. Write program, which reads a, b, and c. Let ax + by + c = 0 be equation of a line. The
program outputs the slope. Input 3 5 8 output - 0.6.
16. A student is awarded Ex grade if he gets more than 90 marks. He is awarded A grade if
marks are between 80 and 89. Similarly range for B, C, D and P are 70-79, 60-69, 50-59,
and 35-49 respectively. The student is awarded F grade if he gets less then 35 marks.
Write a program, which reads marks of a student and prints his grade.
17. Write a program to calculate the commission for a salesman. The commission is
calculated according to the following rates: 15% commission for sales amount 30001
onwards. 10% commission for sales amount 22001 to 30000, 7% commission for sales
amount 12001 to 22000, 3% commission for sales amount50001 to 12000. No
commission otherwise.
18. Write a program that reads five integer numbers from the keyboard, and display the
largest and smallest of the numbers entered.
19. Write program, which reads a, b and c. Let ax2 + bx + c = 0 be a quadratic equation. If
roots are real and distinct then both roots are printed. If roots are equal then only one root
is printed. If roots are imaginary then real part and complex parts of both roots are
printed. e.g. if input is a=1 b=8 c=25 then output is –4, 3 and –3. if input a=2 b=8 c=8
find output. Input 2 10 12 find output.
20. Write program, which reads a, b, and c. Let x2 + y2 + 2ax + 2by + c = 0 be equation of a
circle. Print its center and radius. Input 10, -6 and -2 then output is center (-10, 6) and
radius 11.7. Here circle is x2+y2+20x-12y-2=0.
21. Admission to a professional course is subject to the following conditions: (a) marks in
Mathematics is greater than or equal to 60 (b) marks in Physics is greater than or equal to
50 (c) marks in Chemistry is greater than or equal to 40 (d) total in all three subjects is
either greater than or equal to 200 or total in mathematics and physics is greater than or
equal to 150. Given the marks in three subjects, write a program to process the
applications to the list of eligible candidates.