c++ lab sheet kuppiya- 2

Lab Sheet 2

1. Write pseudo code to input 2 numbers and find the total

Begin
Input first number and second number
Total = first number + second number
output Total
End

2. Write pseudo code to input 3 numbers and find the average.

Begin
Input first number second number and third number
Total = first number + second number + third number
Average = Total/3
Output Average
End

3. Write pseudo code to input 2 numbers and find the larger one.

Begin
Input first number and second number
if first number>second number then
Display “first number”
Else
Display “second number”
End if
End

4. Write pseudo code to input an age of a person and find whether the person is an adult or a child. (Age>18 considered as an adult)

Begin
Input Age
If Age > 18 then
Display “Adult”
Else
Display “Child”
End if
End

5. Write pseudo code to convert temperature from Fahrenheit degrees to Celsius degrees.
Use the equation C = 5/9*(F-32), Where C is Celsius and F is Fahrenheit.

Begin
Input Value
f = value
c = 5/9 *(f-32)
Display c
End

Please comment.Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *