315 views
0 votes
0 votes
how to deal with multiple printf statement in C language. how this code will work??

void main()

{

clrscr();

printf("%d%d%d", printf("GATE"),printf("2018"),printf("IITian"));

}

2 Answers

Best answer
4 votes
4 votes
IITian2018GATE446         is o/p          // as printf evaluates from right to left so first IITian then 2018 and than GATE will be printed and  printf returns the no. of charcters for gate its 4 , for 2018 its 4 and for iitian its 6  , and due to %d it will print integer value
selected by
0 votes
0 votes
Evaluation of printf will be done from right to left so it wil print IITian 2018 GATE and printing will be done as 4 4 6 so the output will be

IITian GATE 2018 4 4 6

Related questions

1 votes
1 votes
2 answers
1
Parimal Paritosh asked Feb 6, 2019
973 views
int main(){float sum, i = 1.0, j = 2.0;while (i/j 0.0625){j = j + j;printf("%f", i+j);}}The number of times printf statement is executed is:
2 votes
2 votes
0 answers
3
adwaitLP asked Oct 10, 2016
1,206 views
Very basic C language doubt regarding \5 #include <stdio.h int main() { printf("\5"); return 0; }why the output of this code is ♣??
1 votes
1 votes
3 answers
4
jverma asked May 23, 2022
1,067 views
#include <stdio.h>int f(int n){ static int r = 0; if (n <= 0) return 1; r=n; return f(n-1) + r;}int main() { printf("output is %d", f(5)); return 0;}Ou...