Wednesday, 13 July 2016

WAP TO ACCEPT N NUMBERS AND DISPLAY THE ARRAY IN THE REVERSE ORDER. WRITE A SEPARATE FUNCTIONS TO ACCEPT AND DISPLAY

#include<stdio.h>
void accept(int [],int);
void display(int [],int);
main()
{
int a[50],n;
printf("Enter no. of elements:");
scanf("%d",&n);
accept(a,n);
display(a,n);
}
void accept(int a[],int n)
{
int i;
printf("Enter elements");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
}
void display(int a[],int n)
{
int i;
printf("Reverse:");
for(i=n-1;i>=0;i--)
{
printf("\n%d",a[i]);
}

}



ASSIGNMENT 9)

  TO DEMONSTRATE USE OF 1-D ARRAY AND FUNCTIONS.


No comments:

Post a Comment