Skip to content

Instantly share code, notes, and snippets.

@qassa
Created September 29, 2013 11:43
Show Gist options
  • Save qassa/6751770 to your computer and use it in GitHub Desktop.
Save qassa/6751770 to your computer and use it in GitHub Desktop.
// сумма целых чисел от 0 до x
#include<conio.h>
#include<stdio.h>
double sum (int n){
int i=0; double h=0;
for(;i<=n;i++)
h+=i;
return h;
}
int main (){
int x;
double f;
scanf("%d",&x);
f=sum(x);
printf("%lf",f);
getch();
return 0;
}
// сумма целых чисел от 0 до x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment