0% found this document useful (0 votes)
24 views3 pages

If Else If Programs

Uploaded by

sitsmebro
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views3 pages

If Else If Programs

Uploaded by

sitsmebro
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

1. Write a C program to read the age of a candidate and determine whether he is eligible to cast his/her own vote.

2. 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.

3. Write a C program to accept the height of a person in centimeters and categorize the person according to their
height.
Test Data : 135
Expected Output :
The person is Short.

4. Write a C program to find the largest of three numbers.

5. Write a C program to accept a coordinate point in an XY coordinate system and determine in which quadrant the
coordinate point lies.
Test Data : 7 9
Expected Output :
The coordinate point (7,9) lies in the First quadrant.

6. Write a C program to determine eligibility for admission to a professional course based on the following criteria:
Eligibility Criteria : Marks in Maths >=65 and Marks in Phy >=55 and Marks in Chem>=50 and Total in all three
subject >=190 or Total in Maths and Physics >=140

Sample I/O:

Input the marks obtained in Physics :65 Input the marks obtained in Chemistry :51 Input the marks obtained in
Mathematics :72 Total marks of Maths, Physics and Chemistry : 188 Total marks of Maths and Physics : 137 The
candidate is not eligible.
Expected Output :
The candidate is not eligible for admission.

7. Write a C program to read the roll no and marks of three subjects and calculate the total, percentage and Class
division.

Percentage Class Division


>75% First class with distinction
>=60 and <75% First class
>=50 and <60% Second class
>=40 and <50% Pass
<40% Fail

Sample I/O:

Test Data :
Input the Roll Number of the student :784
Input the marks of Physics, Chemistry and Computer Application : 70 80 90
Expected Output :
Roll No : 784
Marks in Physics : 70
Marks in Chemistry : 80
Marks in Computer Application : 90
Total Marks = 240
Percentage = 80.00
Division = First class with distinction.
8. Write a C program to read temperature in centigrade and display a suitable message according to the temperature
state below:

Temp < 0 then Freezing weather


Temp 0-10 then Very Cold weather
Temp 10-20 then Cold weather
Temp 20-30 then Normal in Temp
Temp 30-40 then Its Hot
Temp >=40 then Its Very Hot

Test Data :
42
Expected Output :
Its very hot.

9. Write a C program to check whether a triangle is Equilateral, Isosceles or Scalene.

Test Data :
50 50 60
Expected Output :
This is an isosceles triangle.

10. Write a C program to check whether an alphabet is a vowel or a consonant.

Test Data :
k
Expected Output :
The alphabet is a consonant.

11. Write a program in C to calculate and print the electricity bill of a given customer. The customer ID and unit
consumed by the user should be captured from the keyboard to display the total amount to be paid to the customer.

The charge are as follow :

Unit Charge/unit

upto 199 @1.20

200 and above but less than 400 @1.50

400 and above but less than 600 @1.80

600 and above @2.00

If bill exceeds Rs. 400 then a surcharge of 15% will be charged and the minimum bill should be of Rs. 100/-
Test Data :
1001
800
Expected Output :
Customer IDNO :1001
unit Consumed :800
Amount Charges @Rs. 2.00 per unit : 1600.00
Surchage Amount : 240.00
Net Amount Paid By the Customer : 1840.00

You might also like