#include<stdio.h>
int reversearray(int n)
{
int i , j ,k, a[1000], num;
num = n;
printf(" Enter the elements of the array : \t");
for(j=0;j<num;j++)
{
scanf("%d",&a[j]);
}
i=j-1;
j=0;
while(i>j)
{
k = a[j];
a[j] = a[i];
a[i] = k;
j=j+1;
i=i-1;
}
printf(" \n\n The reverse of the array is :\t");
for(j=0;j<num;j++)
{
printf("\n%d\t",a[j]);
}
return 0;
}
int main()
{
int n , x;
printf(" Enter the Size Of The Array : ");
scanf("%d",&n);
x = reversearray(n);
return 0;
}
int reversearray(int n)
{
int i , j ,k, a[1000], num;
num = n;
printf(" Enter the elements of the array : \t");
for(j=0;j<num;j++)
{
scanf("%d",&a[j]);
}
i=j-1;
j=0;
while(i>j)
{
k = a[j];
a[j] = a[i];
a[i] = k;
j=j+1;
i=i-1;
}
printf(" \n\n The reverse of the array is :\t");
for(j=0;j<num;j++)
{
printf("\n%d\t",a[j]);
}
return 0;
}
int main()
{
int n , x;
printf(" Enter the Size Of The Array : ");
scanf("%d",&n);
x = reversearray(n);
return 0;
}
OUTPUT :
Follow
Me On Social Media :-
INSTA photography page :- https://www.instagram.com/photo_mania_hub/
Twitter link : - https://twitter.com/ApurbaKhanra199
Facebook page link (Crazy Coders) :-https://www.facebook.com/codercrazy/?modal=admin_todo_tour
Insta photography link :- https://www.instagram.com/photo_mania_hub/
Facebook link :- https://www.facebook.com/profile.php?id=100009747586288
For tech related videos visit my other website :- https://apurbatechinfo.blogspot.com/
0 Comments