Skip to content

Instantly share code, notes, and snippets.

@sauloh
Last active October 14, 2017 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sauloh/ba158777c4c9567105b2c757766dc19e to your computer and use it in GitHub Desktop.
Save sauloh/ba158777c4c9567105b2c757766dc19e to your computer and use it in GitHub Desktop.
#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