C program to Maximum value of Array

Below is C program to Maximum value of Array.

Program:

/* Maximum value of Array */
 
#include<stdio.h>

int main()
{
 int arr[10],i,max=0;
 printf("Please enter 10 values:\n");
 for(i=0;i < 10;i++)
  scanf("%d",&arr[i]);
 
 max=arr[0];
 for(i=1;i<10;i++)
 {
  if(max < arr[i])
   max=arr[i];
 }
 
 printf("Maximum value of Array: %d",max);
 return 0;
}

No comments:

Post a Comment