1080 Highest and Position

SemiColon
By -
0
URI Online Judge | 1080

Highest and Position

Read 100 integer numbers. Print the highest read value and the input position.

Input

The input file contains 100 distinct positive integer numbers.

Output

Print the highest number read and the input position of this value, according to the given example.
Input SampleOutput Sample
2
113
45
34565
6
...
8
 
34565
4


Solution:
#include <stdio.h>

int main()
{
 int n, max = -1, p, i;
 for (i = 1; i <= 100; i++)
 {
  scanf("%d", &n);
  if(max < n)
   max = n, p = i;
 }

 printf("%d\n%d\n", max, p);

 return 0;
}


Tags:

Post a Comment

0Comments

Post a Comment (0)