LAB TASK 01
Q1: Add three numbers.
Step 01:
Get the input from user for three number, say a,b,c .
Step 02:
Add the numbers a+b+c .
Step 03:
Print the output.
Flow Chart:
Start
input a,b,c
a+b+c
Output Result
End
Q2: Find the Largest of Three Numbers.
Step 01:
Get the input from user for three number, say a,b,c .
Step 02:
Compare the numbers using conditional statements OR using the max
function in C++.
Step 03:
Print out the result.
Flow Chart:
Start
Input A,b,c
a>b ?
a>c ?
.......
Output
End
Q3: Check Whether a Number is Even or Odd.
Step 01:
Get the number as input from the user.
Step 02:
Now divide the number by 2. If remainder is 0 then the number is even and if 1
then the number is odd.
Step 03:
Print out the result.
Flow Chart:
Start
Input x
x%2
No
x%2 = 0? Output Odd
Yes
Output Even
End
Start
Input x
x%2
Q4: Calculate the Factorial of a Number.
Step 01:
Take the number as input from the user.
Step 02:
Multiply the number with its decrement by 1 until the number isn’t decreased
to 0.
Step 03:
Print out the final result.
Flow Chart:
Start
Input n
x=1
x = n*x
n= n-1
No
n=1?
Yes
Output x
End
Q5: Convert temperature from C to F
Step 01:
Take the input from user.
Step 02:
Use the formula to convert it:
F = (Co *9/5) + 32
Step 03:
Print out the result.
Flow Chart:
Start
input C
F = (C*9/5) + 35
Output F
End