Why my code is not working? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why my code is not working?

#include<studio.h> int main (){ int num; printf("Enter any number\n); scanf("%d",&num); for (int i =1, i<10, i++) int result=num*i; printf("%d ×%d =%d", num,i, result); } return 0; }

19th Oct 2023, 1:19 PM
virendra singh
virendra singh - avatar
3 Answers
+ 7
virendra singh Few errors in your code,Let's discuss about the error. #First:- typo in the `#include` statement. It should be `#include <stdio.h>` instead of `#include<studio.h>`. #Secound:- In`for` loop, missing semicolons(;). It should be `for (int i = 1; i < 10; i++)`. #Third:- missing " " in printf statement..it should be `printf("Enter any number:\n");` #See this modified version.. https://code.sololearn.com/cTduK0Y1Xri8/?ref=app #Attention plz:- Always use only correct tags..for example use your code is related to c language so use only `c` Tags, instead of `codeplayground`.
19th Oct 2023, 1:30 PM
Darpan kesharwani🇮🇳[Inactive📚]
Darpan kesharwani🇮🇳[Inactive📚] - avatar
+ 1
Because you didn't code well
19th Oct 2023, 5:04 PM
Princess Myra Nyame
Princess Myra Nyame - avatar
+ 1
Corrected version #include<stdio.h> int main (){ int num; printf("Enter any number\n"); scanf("%d",&num); for (int i =1;i<=10;i++){ int result=num*i; printf("%d ×%d =%d\n", num,i, result); } return 0; }
21st Oct 2023, 7:20 AM
Abhay Gomkale
Abhay Gomkale - avatar