You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
programming-examples/c/Basic/To find the maximum number ...

28 lines
562 B
C

#include <stdio.h>
#include <conio.h>
void main()
{
int n,*p,i,h=0;
clrscr();
printf("\nHOW MANY NUMBERS: ");
scanf("%d",&n);
p=(int *) malloc(n*2);
if(p==NULL)
{
printf("\nMEMORY ALLOCATION UNSUCCCESSFUL");
exit();
}
for(i=0;i<n;i++)
{
printf("\nENTER NUMBER %d: ",i+1);
scanf("%d",(p+i));
}
h=*p;
for(i=1;i<n;i++)
{
if(*(p+i)>h)
h=*(p+i);
}
printf("\nTHE HIGHEST NUMBER IS %d",h);
getch();
}