Professional Documents
Culture Documents
Algorithm
Start Read Coefficients a,b,c db2-4ac if (d=0) Then goto Step5 Else goto Step8 r1 -b/2a r2-b/2a Print r1, r2 goto Step13 if (d>0) Then goto Step9 Else goto Step12 r1 -b+sqrt(d)/2a
Department of Computer Science and Engineering
Step 10: r2 -b-sqrt(d)/2a Step 11: Print r1, r2 goto Step13 Step 12: Print Roots are Imaginary Step 13: Stop
Sarju S, Lecturer
2Computer Programming
Flow Chart
Start
d b * b - (4 * a * c)
Yes
d=0
No
r1 - b / (2 * a)
Yes
d>0
No
r2 - b / (2 * a)
r1 ( - b + sqrt(b)) / (2 * a)
r2 ( - b - sqrt(b)) / (2 * a)
End
3Computer Programming
Algorithm
Step 1: Step 2: Step 3: Step 4: Step 5: Step 6: Step 7: Step 8: Step 9: Step10:
Start Read Decimal number dec Set bin 0,i 1 if (dec=0) Then goto Step9 Else goto Step5 r dec%2 bin bin + r * i dec floor (dec/2) i i*10 goto Step4 Print Binary Equivalent bin Stop
Department of Computer Science and Engineering
Flow Chart
Sarju S, Lecturer
4Computer Programming
S rt ta
"E te Th D c a Nme" n r e e im l u br G Td c E e
b in 0
i 1
Lo op
Ys e
N o
r e % dc 2
b in+r *i in b
d c o e / 2) e flo r(d c
i *1 i 0
P T"B a E u a n I "+ U in ry q iv le t s b in
E nd
dc 0 e=
5Computer Programming
Start Read the Number number Set rev 0 if (number=0) Then goto Step8 Else goto Step5 r number%10 rev r + rev*10 number floor(number/10) goto Step4 Print Reverse Is rev Stop
Flow Chart
Sarju S, Lecturer
6Computer Programming
S tart
rev 0
Loop
No
r number%10
rev r + rev * 10
End
Sarju S, Lecturer
Yes
number=0