edited by
916 views
0 0 votes
What will be printed by following statement : printf(“%d”,scanf(“%d”,&n));

2 Answers

Best answer
2 2 votes
Scanf returns the no of inputs scanned successfully (if format string does not match scan can fail) and printf returns no of characters printed on the screen , so here 1 is returned by scanf (provided we enter a valid integer) and hence 1 is printed on the screen
selected by
3 3 votes
scanf() returns the number of variables initialized with a value , in this case it is 1 because it stores the value of 1 variable .  Therefore scanf() functions returns 1 , which is printed by printf() . Therefore ans is 1 .
Position:
Show:

Related questions

1 1 vote
2 answers 2 answers
2.9k
2.9k views
Rajesh Pradhan asked Feb 22, 2016
2,915 views
Prove that in a group of 6 people, there are at least three mutual friends or three mutual strangers.
2 2 votes
1 1 answer
3.5k
3.5k views
Rajesh Pradhan asked Feb 22, 2016
3,488 views
1. What is equivalence relation? 2. How can u represent equivalence. relation with a data structure? 3. Which data structure? how efficient? How can u test for. equivalen...