Q:

Entering an array and printing its inverse using c++

0

Write a program to enter an array and print its inverse

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include <iostream>
using namespace std;
int main(){
	int a[100];
	int i,n;
	cout<<"enter array length:";
	cin>>n;
	for(i=1;i<=n;i++){
		cout<<"enter num "<<i<<":";
		cin>>a[i];
	}
	cout<<endl;
	for(i=n;i>=1;i--){
		cout<<a[i]<<"\t";
	}
}

 

Output:

enter array length:3
enter num 1:5
enter num 2:25
enter num 3:60

60      25      5

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Find even and odd numbers using c++... >>
<< Find Factor of a number using c++...