Professional Documents
Culture Documents
Flowchart
Flowchart
a. Write pseudo-code of a program that asks the user to enter two numbers and prints the sum, product,
difference, and division of the two numbers.
Solution:
1 Begin
2 Take the two values num1 and num2 from the user
Multi = num1*num2
Div = num1/num2
Sub = num1-num2
5 End
Q NO 2
a. Write pseudo-code of a program that solves a quadratic equation ax2+bx+c by taking a, b and c as input
from user
Solution
BEGIN
NUMBER a, b, c, d, x1, x2
INPUT a,b,c
d = b^2-4ac
IF (d >= 0) THEN
x1 = (-b+√d)/2a yada x1 = (-b+d^(1/2)/2a
x2 = (-b-√d)/2a yada x2 = (-b-d^(1/2)/2a
OUTPUT "ROOT 1:"+x1
OUTPUT "ROOT 2:"+x2
ELSE IF (d == 0) THEN
x1=x2= -b/2a
OUTPUT "ROOT 1:"+x1
OUTPUT "ROOT 2:"+x2
ELSE
OUTPUT "There is no real root"
ENDIF
END
Q no 3
Start
Input Hours
worked
Input Pay
If hours
work ≤ 40 Hio
stop
Q NO 4
Start
No of quizes
Sum = 0
Count =0
While
count < no
of quizes
Count = count + 1
End