- #1
the_d
- 127
- 0
can someone tell me why this program is equal to 9? I have been sitting for 2
hours trying to figure out how the program gets and when doing it by hand I
get something different. Here is the program:
#include <stdio.h>
int main()
{
int i, j;
int a=0;
for (i=0;i<3;i++)
for (j=0;j<2;j++)
a+=2*i+j-1;
printf("%d\n", a);
return 0;
}
a=9
hours trying to figure out how the program gets and when doing it by hand I
get something different. Here is the program:
#include <stdio.h>
int main()
{
int i, j;
int a=0;
for (i=0;i<3;i++)
for (j=0;j<2;j++)
a+=2*i+j-1;
printf("%d\n", a);
return 0;
}
a=9