Maximum Element in an Array in C programming

Code:
Image result for c programming

Maximum Element in an Array in C programming
CODE:
   #include<stdio.h>
int main(){
  int n,max=0,i,a[20];
  scanf("%d",&n);
  for(i=0;i<n;i++)
  {
    scanf("%d",&a[i]);
    if(a[i]>max)
      max=a[i];
  }
  printf("%d is the maximum element in the array",max);
  return 0;
}

No comments