I am wonder if someone could explain to me, how this for loop works.
public class DoWhat
{
public static void main(string[] args)
{
int x = 0;
int i;
for ( i = 1; i <=4; i++)
{
x = x + (i*i +3);
System.out.printf("%4d %4d\n", i,x);
}// end of loop
}//end main
} //end class DoWhat
i know that the output is
1 4
2 11
3 23
4 43
how dose it come to this out put??
public class DoWhat
{
public static void main(string[] args)
{
int x = 0;
int i;
for ( i = 1; i <=4; i++)
{
x = x + (i*i +3);
System.out.printf("%4d %4d\n", i,x);
}// end of loop
}//end main
} //end class DoWhat
i know that the output is
1 4
2 11
3 23
4 43
how dose it come to this out put??