+ 1

Why is scanf not working in c compiler

23rd Dec 2019, 2:00 PM
Abhishek Malav
21 ответ
+ 9
It will be better if you share the code where you are facing problem ✌ Read this first please https://www.sololearn.com/Discuss/333866/?ref=app
23rd Dec 2019, 2:04 PM
Nova
Nova - avatar
+ 2
Can you specify a example, when it is not working?
23rd Dec 2019, 2:05 PM
Jayakrishna 🇮🇳
+ 2
It works. You are taking the input, after that you are doing nothing, then how can you make sure it is working or not working correctly? print the input value after scanf...
23rd Dec 2019, 2:14 PM
Jayakrishna 🇮🇳
+ 2
What input you are given? If you don't give any value, it prints 0. If you enter an integer number then it print that number.. Input ex: as 9 it prints 9..
23rd Dec 2019, 2:24 PM
Jayakrishna 🇮🇳
+ 2
Abhishek Malav , Checkout the attached code below (about providing code input in SoloLearn), and see through it that you provide a value when the input dialog pops up asking for input. And make sure to create and save that snippet as C code rather than C++ code (in Code Playground). `scanf` does not work if you save that into C++ code. There's a trick to get `scanf` to work for C++ in Code Playground, but that is an entirely different discussion topic : ) https://code.sololearn.com/WhiNb9BkJUVC/?ref=app
25th Dec 2019, 4:31 AM
Ipang
+ 1
Okay i printed a after that and output it shows is 0
23rd Dec 2019, 2:14 PM
Abhishek Malav
+ 1
#include <stdio.h> int main() { int a; printf("enter the value"); scanf("%i",&a); printf("%i",a); }
23rd Dec 2019, 2:20 PM
Abhishek Malav
+ 1
Okay thank u so much, i gotta figure it out.....thanx
23rd Dec 2019, 2:47 PM
Abhishek Malav
+ 1
I think you wanted to: #include <stdio.h> int main() { int a; printf("Enter the value"); scanf("%d", &a); printf ("%d", a); return 0; }
24th Dec 2019, 3:21 AM
Randych
Randych - avatar
0
#include <stdio.h> int main() { int a; printf("enter the value"); scanf("%i",&a); }
23rd Dec 2019, 2:06 PM
Abhishek Malav
0
But the problem is its not asking for values....it just gives the output: enter the value0
23rd Dec 2019, 2:27 PM
Abhishek Malav
0
It running fine on other compiler but not over here
23rd Dec 2019, 2:32 PM
Abhishek Malav
0
👍
25th Dec 2019, 4:58 AM
Abhishek Malav
0
How can I be genius in python
25th Dec 2019, 12:37 PM
Michael Diamond
Michael Diamond - avatar