To scan a and b given below, which of the following scanf() statement will you use? #include<stdio.h> float a; double b;
Question
To scan a and b given below, which of the following scanf() statement will you use? #include<stdio.h>
float a; double b;
Solution
To scan the variables 'a' and 'b' in your code, you would use the following scanf() statement:
scanf("%f %lf", &a, &b);
Here is the step by step explanation:
-
%fis the format specifier for a float in C. So, it is used to take the input for the variable 'a' which is of float type. -
%lfis the format specifier for a double in C. So, it is used to take the input for the variable 'b' which is of double type. -
The
&symbol is used before the variable names 'a' and 'b' to provide the address of the variables, so that scanf() can modify their values. -
The two format specifiers are separated by a space, which means that the input values should also be separated by a space when you enter them.
Similar Questions
Which program outputs "Hello World.." .?a.main(){scanf("Hello World..");}b.main(){printf("Hello World..");}c.main(){print("Hello World..");}d.main(){scan("Hello World..");}
To scan a and b given below, which of the following scanf() statement will you use?#include<stdio.h>float a;
Which of the following function used as reading data ?Options :main()print()scanf()printf()
scanf() is a predefined function in______header file.Answer areaa) stdlib. hb) ctype. hc) stdio. hd) stdarg. H
Which of the following function is utilized to read the values stored in various variables and store these values in a character array?a.scanf()b.printf()c.sscanf()d.sprint()
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.