Lab 2 Tasks C++

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

1.

Write a program that take three integers


& implement the following & notice results?
(𝑎 ∗ (𝑏 + 𝑐))
((𝑎 ∗ 𝑏) + 𝑐)

2. Write a program which takes two


numbers from user and checks which
one is greater or equal (using if else)

3. Write a program which finds whether


number is odd or even (using if else)

4. Write a program which take one number


and check whether it is divisible by 3

5. Write a program which checks whether


Both numbers are equal or not

6. Write a program which calculates


Electricity bill. If units are less than 300,
cost is rs. 3/unit. If units are greater than
300 then cost is rs. 5/unit.

7. Write a program which takes 3 numbers


And check whether they are equal or not.

8. Write a program which asks user to enter


Two numbers and an operator and then
Perform required operation on two values.
i.e. ‘+’ for sum, ‘-’ for subtract etc.

9. Write a program to input three integer values.


Compare the three values to find out if they are equal.
Use “nested if statement” and print the message
“all values are equal” if they all are equal. Otherwise
Print the massage “these values are different”

10. Program test the age of amir and amara ? Decision using if condition
A) using one if condition? Cout<<”amir age is greater than amara”
B) using two if condition? Find out who is elder amir or amara
C) using if and else condition? Find out who is elder amir or amara

11. Make a program that saves temperature from user between 0 c – 100 c.
12. Make a program that take student marks &
Tells you whether he is pass or fail?
Note: passing marks are 60 or more.

13. Modify task 10 take student marks & tell him


what grade he/she has achieved?
Note :grade a (90-100), grade b (80-89),
Grade c (70-79), grade c (60-69),
Grade f (if marks are less than 60)

14. Write welcome on screen if candidate’s intermediate


Marks are greater than 60% and entry test
Marks are greater than 50%.

You might also like