why this code shows no output!? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

why this code shows no output!?

#include <iostream> using namespace std; int main() { int s,n,a,i; for(i=11;i<=99;i++) { n=i; s=0; cout<<i<<":"; while(n>0){ a=i%10; s=s*10+a; i=i/10;} cout<<s<<":"; } return 0; }

2nd Sep 2020, 4:05 PM
Nariman Tajari
Nariman Tajari - avatar
1 Answer
+ 6
You are not changing n value in loop to get exit of that.. You need n=n/10; instead of i=i/10;
2nd Sep 2020, 4:12 PM
Jayakrishna 🇮🇳