[TUHS] A c program problem

Donald ODona mutiny.mutiny at india.com
Wed Aug 22 22:24:26 AEST 2018



At 22 Aug 2018 12:18:08 +0000 (+00:00) from cc <caipenghui_c at 163.com>:
> Hello everyone
> 
> I had a problem compiling a piece of c code from the book. The result of running the book is 5050, but the compiler is 100. I don't know which is right, please help me to see which is wrong. Thank you very much!
> 
> #include <stdio.h>
> 
> int main(void)
> {
>        int i, sum = 0;
>        i = 1;
>        while ( i <= 100) {
>        sum = sum + 1;
>        i++;
>        }
>        printf("%d\n", sum)
>        return 0;
> }
> 
> 
> 
> 
> | |
> cc
> |
> |
> 邮箱:caipenghui_c at 163.com
> |
> 
> 签名由 网易邮箱大师 定制



More information about the TUHS mailing list