Can anyone fix the bug in this code?

Can anyone fix the bug in this code?


#include < stdio.h >
#define LAST 10

int main() {
int i, sum = 0;
for ( i = 1; i < = LAST; i++ ) {
sum += i;
}

/*-for-*/
printf("sum = %d\n", sum);
return 0;
}

» Submitted by Venumadhav Pentam, my colleague in Verizon

http://aruljohn.com/fun/j/bug/

Hozzászólások

A kisebbegyenlo egybe irando


#include <stdio.h>
#define LAST 10

int main() {
    int i, sum = 0;
    for ( i = 1; i <= LAST; i++ ) {
        sum += i;
    }

    /*-for-*/
    printf("sum = %d\n", sum);
    return 0;
}

----
Sooner or later you had to talk, even if it was only because you'd run out of things to throw. - Pratchett
honlap készítés

b&

--
Segmentation violation -- Core dumped blues