Home / C Programming / Input / Output :: Discussion

Discussion :: Input / Output

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

     #include
    
      int main()
      {  
          int i;  
          printf("%d\n", scanf("%d", &i));     
          return 0; 
      } 
    

  2. A.

    25

    B.

    2

    C.

    1

    D.

    5

    View Answer

    Workspace

    Answer : Option C

    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'.


Be The First To Comment