#include<stdio.h>
main()
{
int a[100],n,i,temp;
printf("\nEnter number of terms=");
scanf("%d",&n);
printf("\nEnter the numbers=");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
printf("\nThe original array is\n");
for(i=0;i<n;i++)
{
printf("%d ",a[i]);
}
for(i=0;i<n/2;i++)
{
temp=a[i];
a[i]=a[n-i-1];
a[n-i-1]=temp;
}
printf("\nThe reverse array is\n");
for(i=0;i<n;i++)
{
printf("%d ",a[i]);
}
}
main()
{
int a[100],n,i,temp;
printf("\nEnter number of terms=");
scanf("%d",&n);
printf("\nEnter the numbers=");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
printf("\nThe original array is\n");
for(i=0;i<n;i++)
{
printf("%d ",a[i]);
}
for(i=0;i<n/2;i++)
{
temp=a[i];
a[i]=a[n-i-1];
a[n-i-1]=temp;
}
printf("\nThe reverse array is\n");
for(i=0;i<n;i++)
{
printf("%d ",a[i]);
}
}
No comments:
Post a Comment