Cexercise1-Conditional Statements
Cexercise1-Conditional Statements
Write a C program to accept two integers and check whether they are
equal or not.
Test Data : 15 15
Expected Output :
Number1 and Number2 are equal
2. Write a C program to check whether a given number is even or odd.
Test Data : 15
Expected Output :
15 is an odd integer
3. Write a C program to check whether a given number is positive or
negative.
Test Data : 15
Expected Output :
15 is a positive number
4. 4. Write a C program to find whether a given year is a leap year or not.
Test Data : 2016
Expected Output :
2016 is a leap year.
5. Write a C program to read the value of an integer m and display the
value of n is 1 when m is larger than 0, 0 when m is 0 and -1 when m is
less than 0.
Test Data : -5
Expected Output :
The value of n = -1
6. Write a C program to find the largest of Four numbers.
Test Data : 12 25 52 421
Expected Output :
1st Number = 12, 2nd Number = 25, 3rd Number = 52
4th Number =42
The 3rd Number is the greatest among three
7. Write a C program to accept a coordinate point in a XY coordinate
system and determine in which quadrant the coordinate point lies. Go to
the editor
Test Data : 7 9
Expected Output :
The coordinate point (7,9) lies in the First quadrant.
Test Data :
Input the marks obtained in Physics :65
Input the marks obtained in Chemistry :51
Input the marks obtained in Mathematics :72
Expected Output :
The candidate is eligible for admission.
Unit Charge/unit
18. If bill exceeds Rs. 400 then a surcharge of 15% will be charged
and the minimum bill should be of Rs. 100/-
19. Test Data :
1001
James
800
Expected Output :
Customer IDNO :1001
Customer Name :James
unit Consumed :800
Amount Charges @Rs. 2.00 per unit : 1600.00
Surchage Amount : 240.00
Net Amount Paid By the Customer : 1840.00
20. Write a program in C to accept a grade and declare the
equivalent description
Grade Description
E Excellent
V Very Good
G Good
A Average
F Fail
21. Test Data :
Input the grade :A
Expected Output :
You have chosen : Average