You are on page 1of 7

CSE 201

Structured Programming Language


Practice Problems
Problem 1
• Suppose you know your age in years, months and days ( For
example 19 years, 8 months and 21 days ) and now you want
to know your age in days only. Write a C program to take the
inputs in years, months and days and show the output in
days. You can use
(1 year = 365 days and 1 month = 30 days)
Problem 2
Suppose you took 4 theory courses in a semester and did not
have and lab courses. You know the individual grades you got
from these courses. Write a C program that will take input the
grades of the 4 courses and will calculate and show the GPA of
that term.
Problem 3

The area of a trapezium is the product of the average of length


of two parallel sides and the height of it. Write a C program to
take input the lengths of two parallel sides and the height. You
have to give the area of the trapezium as output.
Problem 4
Write a C program that will take the lengths of the three arms
of a triangle as input and give the area of the triangle as
output.
Find what’s wrong in this code.

You might also like