On 2018-08-22 10:29 AM, cc wrote:
I want to figure out if the book is right or the
compiler is right.
cc
Donald and Dan identified the issue in earlier replies.
$ cc foo.c -o foo
$ ./foo
5050
$ cat foo.c
#include <stdio.h>
int main(void)
{
int i, sum = 0;
i = 1;
while ( i <= 100) {
sum = sum + i;
i++;
}
printf("%d\n", sum);
return 0;
}
--Toby