Write a program to print elements of an array in reverse order

Print Elements of an Array in Reverse Order

Write a program to print elements of an array in reverse order

Object: Write a program to print elements of an array in reverse order. C++ projects for beginners with source code

Code:

#include<iostream>
#include<conio.h>
using namespace std;
void main()
{
int num[5],i;
cout<<“Enter 5 Numbers.\n”;
for(i=0;i<5;i++)
{
cin>>num[i];
}
cout<<“Array in Original form.\n”;
for(i=0;i<5;i++)
{
cout<<num[i]<<” “;
}
cout<<“\nArray in Reverse form.\n”;
for(i=4;i>=0;i–)
{
cout<<num[i]<<” “;
}
getch();
}

Output:

Write a program to print elements of an array in reverse order

M.A Siddiqui

Hi, I am M.A Siddiqui. I'm a Computer Science Student, In this website, I'm teaching you Multiple languages and provides Projects and other Subjects Notes.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *