c Programming Assignments
c Programming Assignments
1. Draw a flowchart to convert the temperature given in degrees Fahrenheit to degrees Celsius, using
the relation c = (5/9) ¥ (f – 32). Translate the flowchart into a C program.
2. Given the radius of a sphere, it is required to compute its volume and area. Draw a flowchart for
the same. Translate the same into a C program. Use the relations: Volume = (4 pr3)/3 and Area = 4
pr2.
3. Develop an algorithm to evaluate the polynomial 3x3 – 5x2 + 6 for x = 2.55. Write a C program for
the same.
4. Given that the integer variables a, b and c have the values 8, 3 and – 5 assigned to them
respectively and the float type variables x, y and z have the values 8.8, 3.5 and – 5.2 assigned to
them respectively, draw a flowchart and hence write a C program to read in the values for the
different variables, perform the following operations and output the results. Comment on the results.
(i) a*b/c
(ii) a% b
(iii) x/y
(iv) x% y
5. Let a and b be two given numbers. After reading in the two given numbers, they are compared. If a
is greater than (or equal to) b, a is declared as larger, otherwise (i.e. else) b is declared as larger
6. Draw the flowchart for determining whether a given integer number is positive or negative. Write
the corresponding C program
7. Draw the flowchart for determining whether a given integer number is odd or even. Write the
corresponding c program
8. Draw the flowchart to find out whether a given year is a leap year or not. Write the corresponding C
program
9. A quadratic equation will be of the form ax2 + bx + c = 0, where a, b and c are called the co-efficients.
The problem here is to find the values of x for which the given equation is satisfied. These values of x
which satisfy the given equation are known as its roots. Draw the flowchart to determine the roots of
a quadratic equation. Write the corresponding C program
10. A worker is paid at an hourly rate of Rs. 45 for the first 36 hours of work. Thereafter overtime is
paid at 1.5 times for every one hour of overtime work. Develop a flow chart to compute the net wages
to be paid to a worker, taking the total number of hours worked as input. Also develop a C program for
the same.
11. Develop a flowchart to obtain the absolute value of a given integer. Also develop a C program for
the same.
12. Given two integers, develop a flowchart to determine whether the first number is divisible by the
second one or not. A suitable message has to be displayed. Also develop a C program for the same.
13. Develop a flowchart to find the smallest among given three integer values which uses only two
way decision making facility. Also develop a C program for the same.
14. Develop a flowchart to multiply an integer variable principal by 3 if the float type variable deposit
is greater than 10.3. Code the same in C