fork download
  1. #include <stdio.h>
  2. int sum(int n) {
  3. int i,c;
  4. for(i=0;i<=n;i++){
  5. c=c+i;
  6. }
  7. return c;
  8. }
  9. int main(void) {
  10. // your code goes here
  11. int a,b;
  12. a=10;
  13. b=sum(a);
  14. printf("1から%dまでの和は%d",a,b);
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
1から10までの和は55