This commit is contained in:
nonstriater
2014-05-13 09:19:55 +08:00
parent 1100bdabce
commit 16cf6be47e
13 changed files with 764 additions and 353 deletions
+47
View File
@@ -0,0 +1,47 @@
#include "stdio.h"
void print_continuous_sequence_sum(int n){// n=1,2
int small=1;
int big=2;
int sum = small+big;
while(small<big && big<=n/2+1){
if (sum==n)
{
printf("%d ,%d\n",small,big);
}
while(sum>n){
sum-=small;
small++;
if (sum==n)
{
printf("%d, %d\n",small,big);
}
}
big++;
sum+=big;
}
}
int main(int argc, char const *argv[])
{
print_continuous_sequence_sum(115);
return 0;
}