scanf | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

scanf

#include <stdlib.h> #include <stdio.h> main() { float x , y ; printf("enter the first number: "); scanf("%0.2f", &x); printf(" enter the second number: "); scanf("%0.1f", &y); } Here I can't get second scanf code to input values. please help me to solve it

17th Feb 2020, 4:05 AM
Geethma Rathnayake
2 Answers
+ 5
#include <stdio.h> int main() { float x , y ; printf("enter the first number: "); scanf("%f", &x); printf("%.2f",x); printf(" enter the second number: "); scanf("%f", &y); printf("%.1f",y); return 0; }
17th Feb 2020, 4:24 AM
Cmurio
Cmurio - avatar
+ 4
SOLOLEARN ONLY REQUESTS THE DATA ONCE, SO IT WILL START TO ENTER MORE THAN TWO DATA YOU HAVE TO WRITE THEM IN THE SAME ENTRY SEPARATED WITH A BLANK SPACE. FOR EXAMPLE: 12.346 67.68 Separated with a blank space
17th Feb 2020, 4:27 AM
Cmurio
Cmurio - avatar