The problem is that this code output stop at 21, it doesn’t continue to 23.
my expected output would be: 11 12 13 21 23 31 32 33
#include <stdio.h>
int main(){
int a=1,b=1;
while(a<=3)
{
b=1;
while(b<=3)
{
if(a==2&&b==2)
continue;
printf("%d%d\n",a,b);
b++;
}
a++;
}
return 0;
}
>Solution :
It is not continuing after a == 2 and b == 2 because before incrementing b to 3 the contninue statement gets executed.
Either move it before if statement like.
[but for this you need to start b from 0 (b=0) and check for "while(b < 3)"]:
++b;
if (a == 2 && b == 2){
continue;
}
or:
while(b<=3){
if(a == 2 && b == 2){
++b;
continue;
}
printf(...);
++b;
}