Last active
October 14, 2017 19:39
-
-
Save sauloh/ba158777c4c9567105b2c757766dc19e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
int main() | |
{ | |
int sum; | |
int counter; | |
int rest; | |
sum = 0; | |
counter = 0; | |
for(counter=0; counter <= 1000; counter++){ | |
rest = counter%2; | |
if ( rest > 0){ | |
sum = counter + sum; | |
} | |
} | |
printf("Result: %d", sum); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment