0% found this document useful (0 votes)
7 views

Start: Input 5 Numbers

The document describes an algorithm to find the highest and lowest numbers from a set of 5 input numbers. It includes: 1) Taking 5 numbers as input and comparing them to find the highest number. 2) If the first number is greater than the others, it is highest, otherwise the algorithm compares the others to find the highest. 3) It similarly compares the numbers to find the lowest.

Uploaded by

Siegfred Laborte
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Start: Input 5 Numbers

The document describes an algorithm to find the highest and lowest numbers from a set of 5 input numbers. It includes: 1) Taking 5 numbers as input and comparing them to find the highest number. 2) If the first number is greater than the others, it is highest, otherwise the algorithm compares the others to find the highest. 3) It similarly compares the numbers to find the lowest.

Uploaded by

Siegfred Laborte
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
You are on page 1/ 1

Experiment 2.1 Algorithm; 1.

) Input 5 numbers }

printf("The highest is %d",high); printf(" and the lowest is %d", low); getch();

2.) If the first number is greater than the Flowchart; second and the second greater than third and the third number greater than the fourth START and the fourth number greater than the fifth. 3.) Display the highest number. 4.) If the first number less than the second and the second number less than third and the third number is less than the fourth and the fourth number less than the fifth.

Input 5 numbers

5.) Display the lowest number.


Progarm Code; #include<stdio.h> #include<conio.h> main() { int a,b,c,d,e; int high, low; printf("Input 5 numbers: "); scanf("%d%d%d%d%d",&a,&b,&c,&d,&e); if(a>b && a>c && a>d && a>e) high = a; else if(b>c && b>d && b>e) high = b; else if(c>d && c>e) high = c; else if(d>e) high = d; else high = e; if(a<b && a<c && a<d && a<e) low = a; else if(b<c && b<d && b<e) low = b; else if(c<d && c<e) low = c; else if(d<e) low = d; else low = e;

Is a>b? Y Is b>c Y Is c>d Y Is d>e Y


Display Highest Number

N Is a<b N Y Is b<c Y Is c<d Y N Is c<e Y


Display Lowest Number

END

You might also like