scanf()
returns number of receiving arguments successfully assigned or EOF in case of failure.
Read more about scanf() here.
In context of your program, when you give input 5
the scanf()
successfully assign it to receiving argument i
and since the receiving argument is 1
, scanf()
is returning 1
which is getting printed. Hence you are getting output 1
.
Try to give a character as input and check the output.
0
solved Using scanf funciton in printf to get values