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