Sail E0 Webinar
Question


What will be the output of the program if value 25 given to scanf()?


#include<stdio.h>
int main()
{
int i;
printf("%d\n", scanf("%d", &i));
return 0;
}
Options:
A .  25
B .  2
C .  1
D .  5
Answer: Option C

The scanf function returns the number of input is given.

printf("%d`setminus`n", scanf("%d", &i)); The scanf function returns the value 1(one).

Therefore, the output of the program is '1'.



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers