Reverse Number Sequence in Array C Plus Plus

By | July 11, 2019

Task: Reverse Number Sequence in Array C Plus Plus

The Source Code of Reverse Number Sequence in Array C Plus Plus Program

// Write a C++ program to input 10 numbers
// in array then display actual array
// and in reverse order from last to first
//element.
// Author: www.EasyCodeBook.com (c)
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
	
	int arr[10],i;
	for(i=0;i<10;i++)
	{
		cout<<"Enter Number "<<(i+1)<<"  :";
		cin>>arr[i];
	}
	cout<<"Array in Actual order is:"<<endl;
	for (i=0;i<10;i++)
	cout<<arr[i]<<", ";
	cout<<"\nArray in Reverse order is:"<<endl;
	for (i=9;i>=0;i--)
	cout<<arr[i]<<", ";

	return 0;
}

Output of C++ Program to print array in reverse order sequence

Enter Number 1  :12
Enter Number 2  :2
Enter Number 3  :3
Enter Number 4  :67
Enter Number 5  :8
Enter Number 6  :10
Enter Number 7  :112
Enter Number 8  :760
Enter Number 9  :11
Enter Number 10  :55
Array in Actual order is:
12, 2, 3, 67, 8, 10, 112, 760, 11, 55,
Array in Reverse order is:
55, 11, 760, 112, 10, 8, 67, 3, 2, 12,
--------------------------------
Process exited after 43.05 seconds with return value 0
Press any key to continue . . .

Loading

Leave a Reply

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