This program allows you to calculate the table of up to 10 up to a given number x. But in the cycle of while
after the first iteration it does not enter and jumps to the end. For example, if I enter 2 my output is:
Introduza o numero da tabuada que quer!
3
tabuada do 0
0x3=0
1x3=0
2x3=0
3x3=0
4x3=0
5x3=0
6x3=0
7x3=0
8x3=0
9x3=0
10x3=0
tabuada do 1
tabuada do 2
tabuada do 3
The code that generates the output above is as follows:
void main()
{
int i,x, a, resultado;
printf(" Introduza o numero da tabuada que quer!\n\n");
scanf("%d", &a);
i = 0;
x = 0;
do {
printf(" tabuada do %d\n\n", x);
{
while (i <= 10)
{
resultado = i*x;
printf(" %dx%d=%d\n", i, a, resultado);
i++;
}
}
x++;
} while (x <= a);
}