0% found this document useful (0 votes)
8 views1 page

If Else

The document contains a series of C++ programming tasks that involve user input and conditional statements using if-else. Tasks include checking character types, calculating days in a month, swapping values, computing electricity bills, applying salary deductions, determining even or odd numbers, and displaying age-related messages. Each task emphasizes the use of if-else statements for decision-making in programming.

Uploaded by

muntahaimran709
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)
8 views1 page

If Else

The document contains a series of C++ programming tasks that involve user input and conditional statements using if-else. Tasks include checking character types, calculating days in a month, swapping values, computing electricity bills, applying salary deductions, determining even or odd numbers, and displaying age-related messages. Each task emphasizes the use of if-else statements for decision-making in programming.

Uploaded by

muntahaimran709
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/ 1

1.

C++ Program to take a value from the user as input any character and check whether it is
the alphabet, digit or special character. Using if-else.

2. C++ Program to take a value from the user as input the month number and print number
of days in that month. Using if-else.

3. Write a program to swap the values of two number if values of both variables are not the
same using if-else statement

4. Using the if-else, C++ Program to take a value from the user as input electricity unit
charges and calculate total electricity bill according to the given condition: For the first
50 units Rs. 0.50/unit………….For the next 100 units Rs. 0.75/unit…..For the next 100
units Rs. 1.20/unit ……………For unit above 250 Rs. 1.50/unit………An additional
surcharge of 20% is added to the bill…….Using if-else.

5. Input the Salary of an employee and make the following deductions before printing it
out:
If salary is less than or equal to 10,000 then no deduction are done.
If salary is more than 10,000 and less than 25,000 then deduct Rs. 1,000.
If salary is equal to or more than 25,000 then deduct 5 % of the salary.
Test with salary=25,000 and 10,000.

6. Find out whether the input number is even or odd and if the number is even, display
its square and if the number is odd display the cube.

7. Ask the user for his/her age and display the message according to the following
criteria:

If age is less than 16, display "You can't drive."

age is less than 18, display "You can't vote."

age is less than 25, display "You can't rent a car."

age is 25 or over, display "You can do anything that's legal.".

You might also like