Professional Documents
Culture Documents
Lab Report-5
Lab Report-5
OPERATORS
1. OBJECTIVE:
NESTED if STATEMENT:
We write an entire if-else construct within either the body of the if statement or the body of
an else statement. This is called nesting of ifs.
LOGICAL OPERATORS:
C allows usage of three logical operators, namely,&&, || and !. These are to be read as
AND, OR and NOT respectively.
2. IN-LAB TASKS:
Task#1
Write a program to check whether the alphabet entered by user is vowel or consonant.
CODE:
OUTPUT:
CODE:
OUTPUT:
Task#3
Write a program to enter month number and print number of days in the month by using
nested if else.
CODE:
Task#4
Write a program to input sides of a triangle and check whether the triangle is equilateral, isosceles
and scalene by using nested if else.
CODE:
OUTPUT:
axis. CODE:
OUTPUT:
Task#6
Write a program to enter the age of three student and check who is the youngest among them.
CODE:
POST-LAB TASKS:
Task#1
A company insures its driver in the following cases: If
CODE:
OUTPUT:
OUTPUT:
Task#2
Write a C program to input electricity unit charges and calcuate total electricity bill according
to the given coditions. For first 50 unitsRs. 0.50/unit. For next 100 units Rs. 1.50/unit. For next
100 units Rs. 0.75/unit. For unit above 250 Rs. 1.50/unit. An additional subcharge of 20% is
added to the bill.
CODE: