You are on page 1of 2

Algorithm:

1. Start.
2. Initialize char Run = true, int menu.
3. Display menu and enter the choice for menu.
4. If menu == 1.
Initialize int=0, even=0, odd=0, num.
for(i=0;i<=9;i++), Enter the value of num.
if (num==0), then zero = zero+1.
if (num%2==0), then even = even+1.
else odd = odd+1.
Display the value of even, odd, and zero.
Back to menu.
5. If menu == 2.
Initialize float area, peri, l, w.
Enter the value of l and w.
area = l*w
peri = 2*(l+).
Display the value of area and peri.
Back to menu.
6. If menu == 3.
Initialize float PI=3.1416, radius, area.
Enter the value of radius.
area = PI*radius*radius.
Display the value of area.
Back to menu.
7. If menu == 4.
Initialize int i=0, positive=0, negative=0, zero=0,num.
For(i=0;i<=9;i++)
Enter the value of num.
If (num>0), then positive = positive+1.
If (num<0), then negative = negative+1.
else zero = zero+1.
Display the total of positive, negative, and zero.
Back to menu.
8. If menu == 5.
Initialize int input, input1, tmp, couter=0, max=0, min=0.
Enter the value of input1, initialize min=input1.
While (couter <=1) enter the value of input.
If (input < min), then min=input.
Increment counter to 1.
If (input > max), then max=input.
Increment counter to 1.
else Increment counter to 1.
Display max and min.
9. If menu == 0.
Choose Y/N (yes or no) to exit program
If Y or y, then exit.
If N or n, then return to menu.
10. Stop.
Flowchart:
Start

A
char Run=true,
int menu

-----------------------------------
---------- M E N U ----------
Input display (1) Odd, Even, Zero
menu (2) Area and Perimeter of a Rectangle
(3) Area and Perimeter of a Circle
(4) Positive, Negative, Zero of an Integer
(5) Largest and Smallest
(0) Exit the Program
-------------------------------

if -----------------------------------
menu==1 1
? T

if
menu==2 2
?
T

if
menu==3 3
?
T

if
menu==4 4
?
T

if
menu==5 5
?
T

if
menu==0 0
? T

B F

Stop

You might also like