This is the way i coded my application however is it possible to do it without an if statement? by incrementing step 2? i triedCode:#include <stdlib.h> int main() { int i,total; for (i = 2; i<=31;i++) { if ( i%2 == 0) { printf("Number : %d \n",i); total += i; }; }; printf("Total : %d \n",total); system("PAUSE"); return 0; }
for (i = 2; i<=31;i+2) but it just goes into an infinite loop displaying 2... what is wrong?