Friday, October 26, 2018

Uri 1080 solution in C | Highest and Position

/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/

#include<stdio.h>
main()
{
    int n=0,i,a,max=0,j;
    for(i=1;i<=100;i++)
    {
        scanf("%d",&a);
        n++;
        if(a>max)
        {
            max=a;
            j=n;
        }
    }
    printf("%d\n%d\n",max,j);
    return 0;
}

 //Happy_Coding

No comments:

Post a Comment