Friday, April 17, 2009

TO DISPLAY ELEMENTS IN REVERSE ORDER

//wap to display array elements in reverse order
#include
#include
void main()
{
int a[20],n,i;
int *ptr,*big,*low;
clrscr();
printf("Enter n value");
scanf("%d",&n);
for(i=0;iscanf("%d",&a[i]);
ptr=a;
*big=0;
for(i=0;i{
if(*big<*ptr)
*big=*ptr;
if(*low>*ptr)
*low=*ptr;
ptr++;
}
printf("\n elements of array :\n");
for(i=0;iprintf("%d\t",a[i]);
printf("\n Biggest value of array:%d",*big);
printf("\n Lowest value of an array : %d",*low);
getch();
}

No comments: