What is the Program to find the largest element in an array and position occurrence?
#include<stdio.h>
#include<conio.h>
main()
{
int a[100];
int n,largest,index,position;
printf("enter the number of elements in the array");
scanf("%d",&n);
printf("enter %d elements",n);
for(index=0;index<n;index++)
scanf("%d",&a[index]);
largest=a[0];
position=0;
for(index=1;index<n;index++)
if(a[index]>largest)
{
largest=a[index];
position=index;
}
printf("largest element in the array is %d\n",largest);
printf("largets element's position in the array is
%d\n",position+1);
getch();
}