Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Assignment 2

1. What is type declaration instruction, explain this with suitable example.


2. Evaluate the following Arithmetic expressions and show their hierarchy.
a. 𝑎 = 𝑏 ∗ 4 / 𝑏 − 𝑏 + 𝑐 / 2 + 𝑏 / 8
(Assume 𝑏 = 4 and 𝑐 = 1, and 𝑎, 𝑏, 𝑐 are integer type)
b. 𝑎 = 𝑏 ∗ 4 / 𝑏 − 𝑏 + 𝑐 / 2 + 𝑏 / 8
(Assume 𝑏 = 4.0 and 𝑐 = 1.0, and 𝑎 is integer 𝑏, 𝑐 are float type)
c. 𝑎 = 𝑏 ∗ 4 / 𝑏 − 𝑏 + 𝑐 / 2 + 𝑏 / 8
(Assume 𝑏 = 4 and 𝑐 = 1, and 𝑎 is float 𝑏, 𝑐 are integer type)
d. 𝑎 = 𝑏 ∗ 4 / 𝑏 − 𝑏 + 𝑐 / 2 + 𝑏 / 8
(Assume 𝑏 = 4.0 and 𝑐 = 1.0, and 𝑎, 𝑏, 𝑐 are float type)
3. Convert the following expressions in C expression.
a. 𝐴 = 𝜋𝑟 2 ℎ
9.3 ( 𝑎 + 𝑏 )2 / 𝑐 + 2.4 − 2 𝑎 / ( 7.5 + 𝑑 )
b. 𝑍 =
(𝑎+𝑏)/𝑐
𝑥 2 + 𝑥𝑦 + 𝑦2
c. 𝐸 =
𝑥 2 − 𝑥𝑦 + 𝑦2
4. Ramesh’s basic salary is input through the keyboard. His dearness allowance is 40% of
basic salary, and house rent allowance is 20% of basic salary. Write a C program to
calculate his gross salary.
5. Write down the C program to find out the sum of digits of the five-digit number.
6. Write down the C program to convert temperature from Fahrenheit degree to
Centigrade degree.
7. Write down the C program to reverse the used given integer.
8. Write down the C program and draw the flow chart to find out any user given year is a
leap year or not?
9. Write down the C program to find out the user given three coordinates (𝑥1 , 𝑦1 ), (𝑥2 , 𝑦2 )
and (𝑥3 , 𝑦3 ) fall in straight line or not?
10. Write down the C program to check whether the triangle is equilateral, scalene, or
isosceles. Sides of triangle input through keyboard.
11. Write a C program to input any character and check whether it is alphabet, digit, or
special character using conditional operator.
12. Write a C program using Switch to input marks of five subjects Physics, Chemistry,
Biology, Mathematics and Computer. Calculate percentage and grade according to
following:
a. Percentage >= 90% : Grade A
b. Percentage >= 80% : Grade B
c. Percentage >= 70% : Grade C
d. Percentage >= 60% : Grade D
e. Percentage >= 40% : Grade E
f. Percentage < 40% : Grade F

You might also like