include
int main()
{
int i,j,temp,n,z,x;
printf("\n Enter the length of the array \n ");
scanf("%d",&n);
int a[n];
printf("\n Enter the elements for the array \n");
for(z=0;z
{
scanf("%d", &a[z]); // Entering elements for the array
}
for(j=0;j<n-1;j++) // for loop for n-1 iterations
{
for(i=0;i
{
temp=a[i];
a[i]=a[i++];
a[i++]=temp;
}
}
printf("\n The reversed number is as follows \n");
for(z=0;z<n;z++)
{
printf("%d",a[z]);
}
}
Aucun commentaire:
Enregistrer un commentaire