0% found this document useful (0 votes)
5 views

Practice Questions

The document contains a series of practice questions for programming in C, focusing on conditional statements. Each question requires writing a C program to solve specific problems, such as performing arithmetic operations, determining eligibility for voting or admission, and calculating various conditions like profit or loss. The exercises aim to enhance programming skills by applying logic and control structures in C.

Uploaded by

farhanafathimaam
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Practice Questions

The document contains a series of practice questions for programming in C, focusing on conditional statements. Each question requires writing a C program to solve specific problems, such as performing arithmetic operations, determining eligibility for voting or admission, and calculating various conditions like profit or loss. The exercises aim to enhance programming skills by applying logic and control structures in C.

Uploaded by

farhanafathimaam
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Programming in C

Conditional Statement – Practice Questions

1.1 Write a C program, which takes two integer operands and one operator form the
user, performs the operation and then prints the result. (Consider the operators
+,-,*, /, % and use Switch Statement)

1.2 Write a C Program to find the roots of a Quadratic Equation.

1.3 Write a C program to read the age of a candidate and determine whether it is
eligible for casting his/her own vote.
Test Data: 21
Expected Output: Congratulation! You are eligible for casting your vote.

1.4 If cost price and selling price of an item are input through the keyboard, write a
program to determine whether the seller has made profit or incurred loss. Also
determine how much profit he made or loss he incurred.

1.5 Write a C program to find the eligibility of admission for a professional course
based on the following criteria:
Eligibility Criteria: Marks in Maths >=65 and Marks in Physics >=55 and Marks in
Chemistry>=50 and Total in all three subject >=190 or Total in Maths and Physics
>=140

1.6 Any integer is input through the keyboard. Write a program to find out whether it
is an odd number or even number.

1.7 Write a C program to read roll no, name and marks of three subjects and calculate
the total, percentage.
If the percentage of the marks >=75 then print First Class with Distinction
If the percentage of the marks >=60 and <75 print First Class
If the percentage of the marks <60 print Second Class

1.8 Any year is input through the keyboard. Write a program to determine whether
the year is a leap year or not.

1.9 Write a C program to read temperature in centigrade and display a suitable


message according to temperature state below
Temperature < 0 then Freezing weather
Temperature 0-10 then Very Cold weather
Temperature 10-20 then Cold weather

visakh
Temperature 20-30 then Normal in Temp
Temperature 30-40 then Its Hot
Temperature >=40 then Its Very Hot

1.10 If the ages of Ram, Shyam and Ajay are input through the keyboard, write a
program to determine the youngest of the three.

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


Hint: Equilateral triangle: All three sides are equal.
Isosceles triangle: All two sides are equal.
Scalene triangle: No sides are equal.

1.12 Write a program to check whether a triangle is valid or not, when the three angles
of the triangle are entered through the keyboard. A triangle is valid if the sum of all
the three angles is equal to 180 degrees.

1.13 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 charges 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/-

1.14 Write a program to find the absolute value of a number entered through the
keyboard.

1.15 Write a program in C to read any day in integer number and display day name in
the word.
Test Data : 4
Expected Output : Thursday

1.16 Write a program in C to read any Month in integer number and display Month
name in the word.
Test Data: 4
Expected Output: April

visakh
1.17 Given the length and breadth of a rectangle, write a program to find whether the
area of the rectangle is greater than its perimeter. For example, the area of the
rectangle with length = 5 and breadth = 4 is greater than its perimeter.

1.18 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

1.19 Write a C Program to check Whether a Character is Vowel or Consonant

1.20 Given three points (x1, y1), (x2, y2) and (x3, y3), write a program to check if all the
three points fall on one straight line.

Hint: We ask the user to enter all 3 points (x1, y1), (x2, y2) and (x3, y3). Next we
calculate slope of (x1, y1), (x2, y2) and (x2, y2) (x3, y3). If slopes of both these points
are equal, then all these 3 points lie on same straight line.

visakh

You might also like