Please help me! I am not able to do this. Please explain me my mistake. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Please help me! I am not able to do this. Please explain me my mistake.

I am not able to solve this! #include<stdio.h> int main() {int a; printf("Please Enter Your Number\n"); scanf("%d", &a); printf("You have entered:%d \n" ,a); printf("Multiplication table of %d is given below\n"); printf("%d*1 = %d\n",a*2); printf("%d*2 = %d\n",a*3); } and the output is like this Please Enter Your Number 9 You have entered:9 Multiplication table of 9 is given below 18*1 = 6422376 27*2 = 6422376 please explain where is my mistake. as It is not giving the multiplication result.

11th May 2020, 2:55 PM
Subhadeep Paul
Subhadeep Paul - avatar
5 Answers
+ 6
Exact format is given below and see you haven't included. return 0 #include<stdio.h> int main() {int a; printf("Please Enter Your Number\n"); scanf("%d", &a); printf("You have entered:%d \n" ,a); printf("Multiplication table of %d is given below\n"); printf("%d*1 = %d\n",a,a*1); printf("%d*2 = %d\n",a,a*2); printf("%d*3 = %d\n",a,a*3); printf("%d*4 = %d\n",a,a*4); printf("%d*5= %d\n",a,a*5); printf("%d*6 = %d\n",a,a*6); printf("%d*7 = %d\n",a,a*7); printf("%d*8 = %d\n",a,a*8); printf("%d*9 = %d\n",a,a*9); printf("%d*10 = %d\n",a,a*10); return 0; }
11th May 2020, 3:01 PM
Raj Kalash Tiwari
Raj Kalash Tiwari - avatar
+ 6
You can use for loop it's very simple remove all printf from last and put for(int i=0; i<10; i++) { printf("%d*%d = %d\n",a,i+1,a*(i+1)); }
11th May 2020, 3:08 PM
Raj Kalash Tiwari
Raj Kalash Tiwari - avatar
+ 4
There was a error i removed it , now check it up
11th May 2020, 3:05 PM
Raj Kalash Tiwari
Raj Kalash Tiwari - avatar
0
Ok, Thank you very much. I will check it.
11th May 2020, 3:03 PM
Subhadeep Paul
Subhadeep Paul - avatar
0
I have not learned for loop yet. Thanks you very much for your support. 🤩
11th May 2020, 3:06 PM
Subhadeep Paul
Subhadeep Paul - avatar