C Programming - Input / Output - Discussion
Discussion Forum : Input / Output - Find Output of Program (Q.No. 13)
13.
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;
}
Answer: Option
Explanation:
The scanf function returns the number of input is given.
printf("%d\n", scanf("%d", &i)); The scanf function returns the value 1(one).
Therefore, the output of the program is '1'.
Discussion:
23 comments Page 3 of 3.
Satyam said:
1 decade ago
If we don't write the statement return than what will be the output?
Amarjit said:
1 decade ago
Excellent answer.
Rakesh said:
1 decade ago
I'm still confused. As 25 is given as input. Why it returns 1? explain.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers