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

Complete Conditional Structured

The document contains 26 questions about writing conditional programs in C/C++. The questions cover a range of conditional concepts like if/else statements, checking for positive/negative numbers, even/odd numbers, determining profit/loss, calculating grades based on averages, and more. User input and output is required for all programs.

Uploaded by

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

Complete Conditional Structured

The document contains 26 questions about writing conditional programs in C/C++. The questions cover a range of conditional concepts like if/else statements, checking for positive/negative numbers, even/odd numbers, determining profit/loss, calculating grades based on averages, and more. User input and output is required for all programs.

Uploaded by

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

Conditional Structured

Q 1. Write a program which asks the user to input a no if user enters a negative no the program
should output/print an error and exit.
Q 2. Write a program to calculate the total expenses. Quantity (int) and price (float) per item are
input by the user and discount of 10% is offered if the expense is more than 5000.
Q 3. Write a program that inputs name and 3 subject’s marks(type int) from the user, calculate
marks average (float) if average is greater then and equal to 80 then program display message
you are outstanding.
Q 4. Write a program which asks the user to input 2 numbers now determine which number is
greater and print the result.(using if statement)
Q 5. Write a program which asks the user to input 3 numbers now determine which number is
greater and print the result. (using if statement)
Q 6. Write a program that input a year from the user and display the entered year is a Leap year or
not.
Q 7. Write a C++ program to check whether a character is digit or not.
Q 8. Any integer is input by the user. Write a program to find out whether it is an odd number or
even number.
Q 9. Write a C++ program to check whether a number is divisible 11 or not.
Q 10. Write a program that inputs the name age of two persons, If the ages of Ali, Aslam are input by
the user than determine and display the youngest of the them.
Q 11. Program to check whether a given number is Armstrong number or not.
For example, 371 is an Armstrong number, since 3*3*3 + 7 *7*7 + 1 *1*1 = 371.
Q 12. Write a program to check whether a triangle is valid or not, when the three angles of the
triangle are entered by the user. A triangle is valid if the sum of all the three angles is equal to
180 degrees.
Q 13. 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. Cost price and selling price of an item
is input by the user.
Q 14. Write a program that inputs salary and grade. It adds 70% bonus if the grade is greater than
17.it adds 25% bonus if the grade is 17 or less and then display the total salary.
Q 15. Write a C program to input any character and check whether it is alphabet, digit or special
character.
Q 16. Write a C program to check whether a character is uppercase or lowercase alphabet.
Q 17. Write a program that contains an if statement that may be used to compute the area of a square
(area = side * side) or a triangle (area = * base * height) after prompting the user to type the
first character of the figure name (S or T).
Q 18. Write a C++ program to check whether a number is divisible by 5 and 11 or not.
Q 19. Write a C program to input basic salary of an employee and calculate its Gross salary according
to following:
 Basic Salary <= 10000 : HRA = 20%, DA = 80%
 Basic Salary <= 20000 : HRA = 25%, DA = 90%
 Basic Salary > 20000 : HRA = 30%, DA = 95%
Q 20. Write a C program to input any alphabet and check whether it is vowel or consonant.
Q 21. Write a program to calculate the monthly telephone bills as per the following rule:
 Minimum Rs. 200 for upto 100 calls.
 Plus Rs. 0.60 per call for next 50 calls.
 Plus Rs. 0.50 per call for next 50 calls.
 Plus Rs. 0.40 per call for any call beyond 200 calls.
Q 22. Write a program that determines a student’s grade. The program will read three types of scores
(quiz, mid-term, and final scores) and determine the grade based on the following rules:
 if the average score =90% =>grade=A
 if the average score >= 70% and <90% => grade=B
 if the average score>=50% and <70% =>grade=C
 if the average score<50% =>grade=F
Q 23. The marks obtained by a student in 5 different subjects are input by the user. The student gets a
division as per the following rules:
Percentage above or equal to 60 - First division
Percentage between 50 and 59 - Second division
Percentage between 40 and 49 - Third division
Percentage less than 40 - Fail
Write a program to calculate the division obtained by the student.
Q 24. Write a program that calculates the electricity bill. The rate of electricity per unit as follows.
 If the units consumed are <=100, then the cost is Rs. 5.5/- per unit.
 If the units consumed are <100 and <=250, then the cost is Rs. 7.5/- per unit.
 If the units consumed exceed <250, then the cost is Rs. 10.5/- per unit.
A line rent Rs. 50 is also added to the bill and surcharge of 7% extra if the bill exceeded Rs.
1500/-.calculate the total bill.
Q 25. Write a program that displays the following menu for a parking area.
 Enter B for Bike
 Enter C for car
 Enter T for truck
The program inputs the type of vehicle and number of days to park the vehicle. It finally displays the
total charges for the parking according to the following.
 Bike Rs. 300/- per day
 Car Rs. 5000/- per day
 Truck Rs. 10000/- per day
Q 26. Any character is entered by the user; write a program to determine whether the character entered is
a capital letter, a small case letter, a digit or a special symbol. The following table shows the range
of ASCII values for various characters.
Characters ASCII Values
A–Z 65 – 90
a–z 97 – 122
0–9 48 – 57
special symbols 0 - 47, 58 - 64, 91 - 96, 123 – 127

You might also like