+ 1
What is the error?
Can somebody help me debug this code? https://code.sololearn.com/cgtfvlo6U5Aa/?ref=app
5 Antworten
+ 6
When you were writing this statement:
int num=scanf("%d",&num);
It is necessary to give input which scanf wants. If we give input then it becomes true so it returns 1 to num. That's why it was giving 1 whatever you gave the number.
+ 6
Rewrite line 10 in two lines as follows:
int num;
scanf("%d",&num);
+ 4
Akash Sil you are welcome
+ 1
Swapnil ok now it works, but can you tell me why it wasn't working earlier
+ 1
Swapnil Thanks😊