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