Dear All,
PF below 10 problem statements to check your understanding on if-else concept.
Please share with your class-mates.
“if – else” forms:
1) if (expression)
statement;
OR
2) if (expression)
{
Block of statements;
}
OR
3) if (expression)
{
Block of statements;
}
else
{
Block of statements;
}
OR
4) if (expression)
{
Block of statements;
}
else if(expression)
{
Block of statements;
}
else
{
Block of statements;
}
“if – else” problem definitions:
1) Write a C program to find the larger of two numbers.
2) Write a C program to find the largest of three numbers.
3) Write a C program to check whether a number is even or odd.
4) Write a C program to find the electricity bill given the units consumed under the following conditions:
Units Charge
0 – 100 Rs. 0.85 per unit.
101 – 200 Rs. 0.95 per unit over and above 100 units
> 200 Rs. 1.05 per unit over and above 200 units.
In addition to the above charge, the minimum charge of Rs. 100/-
is incurred on every bill.
5) Write a C program to print the grade of the student given the marks in five subjects.
Percentage Grade
< 35 F
36-50 E
51-59 D
60-69 C
70-79 B
80-89 A
>= 90 S
Note: The percentage is to be rounded off to the next nearest integer.
6) Write a C Program to simulate a simple calculator to perform
basic arithmetic operations.
7) Write a C Program to check whether a 3-digit number is Armstrong Number or not. Note: An Armstrong Number is one where in cubes of individual digits is equal to the given number.
8) Write a C Program to check whether three numbers entered are Pythagorean Triplets or not.
9) Write a program to read two integer values m and n and to decide and print whether m is multiple of n.
10) Write a program to read three values using scanf statement and print the following results:
(a)Sum of the values
(b) Average of the three values
(c) Largest of the three
(d) Smallest of the three.
No comments:
Post a Comment