hello every one
I'm trying to solve this question but i solve it wrong
Write a program to prompt 5 integers from the operator. Find the largest of those 5 integers and display it to the screen.
Sample input-output
Number 1: 8
Number 2: 12
Number 3: 5
Number 4: 22
Number 5: 17
The largest is: 22
this is my solution which is totally wrong
Code:
#include <stdio.h>
int main(void) {
int in, high, i;
for (i=0;i<5;i++) {
printf("Enter an integer: ");
scanf("%d",&in);
if (!i) high = in; // the first loop
else if (in > high) high = in;
}
printf("High: %d\n",high);
return 0;
}