So basicly I have some homework to do, useing for and then while do I need to write this
1 x 1 = 1
2 x 1 = 2
3 x 1 = 3
...
9 x1 = 9
10 x1 = 10
1 x 2 = 2
2 x 2 = 4
...
9 x 10 = 90
10 x 10 = 100
I managed to do it useing for but I just cant get how to do it useing while and do.
Code:int main() { int a; int b; for(a = 1;a < 11; ++a ) { for(b = 1;b < 11; ++b) { int c = a*b; printf(" %4d x %4d = %4d \n", a, b, c); } } return 0; }
This is what I tried with while do
Code:int main() { int a = 0; int b = 1; do { ++a; int c = a*b; printf("%4d X %4d = %4d \n",a, b, c); } while(a<10); }