Another slight change
/* --- sumVersion6.c --- */ #include <stdio.h> int j;int sum = 0;
int sumInts( int limit ) { for ( j=1; j<=limit; j++ ) sum += j; return sum; } void main() {int sum = sumInts( 10 );
printf( "sum of 1..10: %d\n", sum ); sum = sumInts( 5 ); printf( "sum of 1..5: %d\n", sum ); }
Now the program computes two sums using the function. The function uses a global variable.
What does the code write to the monitor?