WAP to take ‘n’ numbers as input and save it in an array and pass entire array to a function, which finds largest number, using pointers
WAP to take ‘n’ numbers as input and save it in an array and pass entire array to a function, which finds largest number, using pointers
#include<stdio.h>
#include<conio.h>
void max(int a[]);
void main()
{
int a[20],i,d,j,k;
clrscr();
for(i=1;i<=5;i++)
{
scanf("%d",&d);
a[i]=d;
}
max(a);
//printf("%d",j);
getch();
}
void max(int a[])
{ int i,e=0;
for(i=1;i<=5;i++)
{
if(a[i]>e)
{
e=a[i];
}
}
printf("%d",e);
}