belongs to collection: collection of C++ quiz questions for beginners
Write a program to enter an array and print its inverse
#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
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Output:
need an explanation for this answer? contact us directly to get an explanation for this answer