0 votes 0 votes #include<stdio.h> void main() { int i; printf("%d", scanf("%d",&i)); //provide input as 100; } Programming in C programming-in-c + – meethunjadhav asked Jul 9, 2018 edited Jul 9, 2018 by srestha meethunjadhav 318 views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
3 votes 3 votes scanf returns how many inputs you provided you are providing one input ===> printf prints 1 as output if your statement is like this printf("%d", scanf("%d %d",&i,&j)); ===> o/p is 2 Shaik Masthan answered Jul 9, 2018 Shaik Masthan comment Share Follow See all 3 Comments See all 3 3 Comments reply Naveen Kumar 3 commented Jul 9, 2018 reply Follow Share here, i'm getting runtime error https://ideone.com/jTdd8F 0 votes 0 votes Shaik Masthan commented Jul 9, 2018 reply Follow Share problem with your code is return type of main return type of main is should be int, why because after successful run of main function it returns the return value 1 to OS, then only OS says that program successfully executed, if os doesn't get value 1 from main, OS says it's an error. 2 votes 2 votes Naveen Kumar 3 commented Jul 9, 2018 reply Follow Share yes & also i was not providing input. this -> https://ideone.com/wTaWnl is working fine! thanks @ Shaik 0 votes 0 votes Please log in or register to add a comment.