35.(C).Array--->>> Finding maximum number among 100 number

 #include<stdio.h>

// cant use i<=n here .Instead we need to use i<n.
// bcz,in array 4 is usually 0,1,2,3 so if we want to
//do something with first 4 number we have to use i<n condition
//
int main()
{
    int num[100],n,i,max;
    printf("Give your number \n");
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",& num[i]);
    }
    max=num[0];
     for(i=0;i<n;i++){
         if(max<num[i])
         
             max=num[i];
         
     }
     printf("%d is max\n",max);

     return 0;
   
}

Comments