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