+ 1
Help to understand code in c languags
I am learning basics of c language, in this part 4 name formatting is difficult to understanding for me. When i run programme there is no output show. My code is here #include <stdio.h> int main() { int x; float num; char text[20]; scanf("%d %f %s", &x, &num, text); }
9 Respostas
+ 4
No output because you are just declaring variables and read them you are not printing them.
Use:
printf("%d %f %s", x, num, text);
But I recomend that you input one at the time so split your scanf in three.
+ 2
Coder Kitten In my opinion to have control over each input. Otherwise each input should be separated by spaces(prone to errors).
+ 1
Input for example
42 1.1 jitendra
separated by space
https://code.sololearn.com/c9809CTesHcH/?ref=app
+ 1
Jeevan Chandra Joshi
You forgot return 0;
Just for consistency.
+ 1
In this code you haven't use any function to print something in output screen.
Here you have use the scanf function which is used to read input from user.If you add a single followed by the scanf statement then it will print which it reads from user.
printf("%d %f %s", x, num, text);
0
I don't understand
0
//This code will produce your output
#include <stdio.h>
int main() {
int x;
float num;
char text[20];
scanf("%d %f %s", &x, &num, text);
printf("%d %f %s", x, num, text);
return 0;
}
0
#include <studio.h>
Int main(){
Int x;
float text[20];
Scanf("%d %f %s", &x, &num, text);
Printf ( %d %f %s", x, num, text);
return 0;
}
0
Thanks to all