main()
{
int a[10],n,i,j,t;
clrscr();
printf("\n Enter no. of terms:");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("\n Enter ele. no. %d-:",i+1);
scanf("%d",&a[i]);
}
for(i=0,j=n-1;i<=n/2;i++,j--)
{
t=a[i];
a[i]=a[j];
a[j]=t;
}
printf("\n Reversed Array\n");
for(i=0;i<n;i++)
printf("\n %d",a[i]);
getch();
}
{
int a[10],n,i,j,t;
clrscr();
printf("\n Enter no. of terms:");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("\n Enter ele. no. %d-:",i+1);
scanf("%d",&a[i]);
}
for(i=0,j=n-1;i<=n/2;i++,j--)
{
t=a[i];
a[i]=a[j];
a[j]=t;
}
printf("\n Reversed Array\n");
for(i=0;i<n;i++)
printf("\n %d",a[i]);
getch();
}
No comments:
Post a Comment