Skip to content

Instantly share code, notes, and snippets.

@yorkie
Created April 7, 2013 13:47
Show Gist options
  • Save yorkie/5330561 to your computer and use it in GitHub Desktop.
Save yorkie/5330561 to your computer and use it in GitHub Desktop.
计算1-100能被7整除的整数的和
#include "stdio.h"
int main(int argc, char const *argv[])
{
int i = 1;
int sum = 0;
while (i <= 100) {
if (i % 7 == 0) sum += i;
i += 1; // 步增不要放在条件语句中
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment