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

PPS Assignment - Conditional Statements

The document contains 8 programming problems involving conditional statements in C. The problems cover topics such as: determining the sign of an integer, identifying quadrants in a coordinate plane, solving quadratic equations, classifying temperature ranges and triangle types, identifying vowels/consonants, calculating electricity bills based on usage tiers, and mapping day numbers to names. Sample test data and expected output is provided for each problem.

Uploaded by

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

PPS Assignment - Conditional Statements

The document contains 8 programming problems involving conditional statements in C. The problems cover topics such as: determining the sign of an integer, identifying quadrants in a coordinate plane, solving quadratic equations, classifying temperature ranges and triangle types, identifying vowels/consonants, calculating electricity bills based on usage tiers, and mapping day numbers to names. Sample test data and expected output is provided for each problem.

Uploaded by

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

PPS Assignment: Conditional Statements

1. 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 Case:
Test Data : -5
Expected Output :
The value of n = -1

2. Write a C program to accept a coordinate point in a 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.

3. Write a C program to calculate the root of a Quadratic Equation.

Test Data : 1 5 7
Expected Output :
Root are imaginary;
No solution

4. Write a C program to read temperature in centigrade and display a suitable message according to
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.

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

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

Test Data :
k
Expected Output :
The alphabet is a consonant.
7. 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 taken from the keyboard and display the total amount
to pay 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

8. Write a program in C to read any day number in integer and display day name in the word.

Test Data :
4
Expected Output :
Thursday

You might also like