what would print under print work for?

0 votes
asked Jul 6, 2019 by akku

int main()

{int i=10,j=2;

 printf ("%d\n", printf ("%d/%d", i, j));


1 Answer

0 votes
answered Jul 12, 2019 by Loki (1,600 points)

The output of the program will be 

output: 10/24

this is due to first the inner printf works 'printf ("%d/%d", i, j)' this prints value of 'i' which is 10 and then '/' character then value of 'j' which is 2 and now the inner printf returns the count of printed information which is 4 in this case 1, 0, / and 2. Thus 4 is printed as the value returned by the inner printf after '10/2'.

Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.