3,087 views
1 votes
1 votes
  1.  #include <stdio.h>
  2.     int main()
  3.     {
  4.         int a = 4, n, i, result = 0;
  5.         scanf("%d", n);
  6.         for (i = 0;i < n; i++)
  7.         result += a;
  8.     }

what is o/p 

a) Addition of a and n.
b) Subtraction of a and n.
c) Multiplication of a and n.
d) Division of a and n.

anyone plz expalin 

1 Answer

4 votes
4 votes
assume n=3

i=0  ;r=0+4=4;

i=1  ;r=4+4=8;

i=2  ;r=8+4=12;

i=3  loop exit;

you can see final result r=12 is multiplication of a and n.

Related questions

0 votes
0 votes
1 answer
1
0 votes
0 votes
1 answer
2