0
What is the error at this nested loop ?
https://code.sololearn.com/czIJVgbE0Aue/?ref=app I want print this output 111111111 222222222 333333333 444444444 555555555 666666666 777777777 888888888 999999999
4 Antworten
+ 1
Check this how its working
#include <iostream> 
using namespace std;
int main() {
  int num, c;
  for (num = 1; num <10; num++) {
    for (c = 1; c <9; c++ ) {
      cout << num ;
    
  }
      cout << endl;
}
  return 0;
}
+ 1
Your code fails right at the first check ( num > 10 ) so doesn't even enter the loop.
Remember that for loop runs till the time condition is true, not till the time it is false.
0
Arsenic  thank you i change it but i don’t know how i can print the above output
0
Sizuna  i understand it right now and thank you so much






