Tuesday, January 4, 2022

Reverse An Array in C

 A  simple program to ask the user to give a series of numbers and then the program will reverse the arrangement of the given numbers using arrays in C programming language.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.


My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.





Program Listing

#include <stdio.h> #define MAX 100 int main() { int arr[MAX],num=0,i=0,temp=0; printf("\n"); printf("\tReverse An Array in C"); printf("\n\n"); printf("\tEnter size of Array : "); scanf("%d",&num); printf("\n\n"); printf("\tEnter the elements :"); printf("\n\n"); printf("\t"); for(i=0;i<num;i++) { scanf("%d",&arr[i]); } for(i=0;i<num/2;i++) { temp=arr[i]; arr[i]=arr[num-i-1]; arr[num-i-1]=temp; } printf("\n\n"); printf("\tArray after reversing : \n"); printf("\t"); for(i=0;i<num;i++) { printf("%d ",arr[i]);; } printf("\n"); printf("\tEnd of Program"); printf("\n"); }

No comments:

Post a Comment