1
#include<stdio.h>
#include<math.h>
int main ( void ){
int x;
int i;
printf("Input the number (Table to be calculated) : ");
scanf("%d", x);
for( i = 1; i <= 10; i++){
printf("%d x %d = %d", x, i, x*i);
}
return 0;
}
Would you like to know the reason for the mistake? I tried creating a variable to hold the value of x*i inside the loop, but it still doesn’t work, after I give the first input seen on the screen, Windows identifies a problem...
The
&
in thescanf()
. You need to specify which memory address will receive the integer value. In this case, the address of the variablex
. So pass on&x
.– eightShirt