0
Why my code is executing for infinite times?
#include <iostream> using namespace std; //reverse number using aaray int main() { int n, array[100], i; cout<<"number of digits in your no.=\n"; cin>>n; cout<<"enter numbers=\n"; for(i=0; i<n; i++) cin>>array[i]; cout<<"reverse no. is=\n"; for(i=n-1; i>=0; i--) cout<<array[i]; return 0; }
4 Answers
0
Check this line :
for(i=0; i<n; i++);
you have a semicolon
0
Still does not work
0
Add your code in playground and
add one number per line :
For example,
3
1
2
5
the result is 521
It works as expected
0
Not yet