C Exercises For Condition
C Exercises For Condition
C Exercises For Condition
1. Write a C program to accept two integers and check whether they are equal or
not. Go to the editor
Test Data : 15 15
Expected Output :
Number1 and Number2 are equal
4. Write a C program to find whether a given year is a leap year or not. Go to the
editor
Test Data : 2016
Expected Output :
2016 is a leap year.
6. 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. Go to the
editor
Test Data : -5
Expected Output :
The value of n = -1
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.
Click me to see the solution
12. Write a C program to read roll no, name and marks of three subjects and
calculate the total, percentage and division. Go to the editor
Test Data :
Input the Roll Number of the student :784
Input the Name of the Student :James
Input the marks of Physics, Chemistry and Computer Application : 70 80 90
Expected Output :
Roll No : 784
Name of Student : James
Marks in Physics : 70
Marks in Chemistry : 80
Marks in Computer Application : 90
Total Marks = 240
Percentage = 80.00
Division = First
19. Write a program in C to calculate and print the Electricity bill of a given
customer. The customer id., name and unit consumed by the user should be taken from
the keyboard and display the total amount to pay to the customer. The charge are as
follow : Go to the editor
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
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 :
Go to the editor
Grade Description
E Excellent
V Very Good
G Good
A Average
F Fail
Test Data :
Input the grade :A
Expected Output :
You have chosen : Average.
21. Write a program in C to read any day number in integer and display day name in
the word. Go to the editor
Test Data :
4
Expected Output :wednesday
22. Write a program in C to read any digit, display in the word. Go to the editor
Test Data :
4
Expected Output :
Four
23. Write a program in C to read any Month Number in integer and display Month name
in the word. Go to the editor
Test Data :
4
Expected Output :
April
24. Write a program in C to read any Month Number in integer and display the number
of days for this month. Go to the editor
Test Data :
7
Expected Output :
Month have 31 days.
25. Write a program in C which is a Menu-Driven Program to compute the area of the
various geometrical shape. Go to the editor
Test Data :
1
5
Expected Output :
The area is : 78.500000
Basic exerecises
Functions
Array exercises
TUTORIALS
EXAMPLES
REFERENCES
Popular Examples
C Examples
C Examples
C Examples
C Examples
All Examples
Introduction
Decision Making and Loops
Functions
Arrays and Pointers
Strings
Structures and Unions
File I/O