Answer to Question #274470 in C++ for fiona

Question #274470

Using loop. Make a program code reverse

( from N to 1) (to 1 - N). 


1
Expert's answer
2021-12-02T06:47:19-0500
#include<iostream>
using namespace std;
int main(){
	int i, N;
	cout<<"Enter the ending value of N i.e 10:  ";
	cin>>N;
	


	cout<<"Before reversing \t";
	for(i=N;i>=1;i--){
		cout<<i<<" ";
	}
	
		cout<<"\n\n";
	cout<<"After reversing \t";
	for(i=1;i<=N;i++){
		cout<<i<<" ";
	}




	
		return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment