Created
September 29, 2013 11:43
-
-
Save qassa/6751770 to your computer and use it in GitHub Desktop.
// сумма целых чисел от 0 до x
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<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