CPP With Algorithm and Flowchart
CPP With Algorithm and Flowchart
Q1. Create a program to compute the volume of a sphere. Use the formula: V = (4/3) *pi*r 3 where pi is equal to 3.1416 approximately. The r is the
radius of sphere. Display the result.
1. Start Start
2. Read r
3. vol = (4/3) *pi*r*r*r
4. Print or display vol
5. Stop Read r
Write vol
Stop
1. Start Start
2. Initialize F=0, C=0
3. Read C
4. Fh = (1.8*C) + 32
C=0, F=0
5. Print or display Fh
6. Stop
Read C
Fh = (1.8*C) + 32
Write Fh
Stop
1. Start
2. Read dollar Start
3. peso = dollar * 51.50
4. Print or display peso
5. Stop Read dollar
Write peso
Stop
1. Start Start
2. Read inch
3. cm = 2.54 * inch
4. Print or display cm
Read inch
5. Stop
Write cm
Stop
1. Start
2. Read x, y Start
3. Declare third variable, z
z=x
x=y Read x, y
y=z
4. Print or display x, y
5. Stop z=x
x=y
y=z
Write x, y
Stop
1. Start
2. Read r Start
3. Calculate circumference by
the equation:
Circum = 2*pi*r Read r
4. Print Circum
5. Stop
Circum = 2*pi*r
Write
Circum
Stop
1. Start
2. Read P Start
3. Read S
4. Read Y
5. D = (P-S) * Y Read P
6. Print or display D
7. Stop
Read S
Read Y
D = (P-S) * Y
Write D
Stop
1. Start
2. Read x and y Start
3. x = x + y
y=x-y
x=x-y Read x, y
4. Print or display x, y
5. Stop
x=x+y
y=x-y
x=x-y
Write x, y
Stop
1. Start
2. Read R Start
3. Read S
4. Read I
5. EOQ = (2*R*S)/I Read R
6. Print EOQ
7. Stop
Read S
Read I
EOQ = (2*R*S)/I
Write EOQ
Stop
1. Start
2. Read r Start
3. Calculate radius by
the equation:
r = sqrt(A/pi) Read A
4. Write r
5. Stop
r = sqrt(A/pi)
Write r
Stop
10 | P a g e Y o u t u b e . c o m / E n g i n e e r s T u t o r www.EngineersTutor.com