fork download
  1. int hoge(int n, int m){
  2. int i,sum=0;
  3. if(n>m){
  4. int temp=0;
  5. temp=n;
  6. n=m;
  7. m=temp;
  8. }
  9.  
  10. for(i=n;i<=m;i++){
  11.  
  12. sum=sum+i;
  13.  
  14. if(i<m) {
  15. printf("%d+",i);
  16. }else{
  17. printf("%d",i);
  18. }
  19. }
  20.  
  21. return sum;
  22.  
  23. }
  24.  
  25. int main(){
  26. printf("=%d", hoge(4,8));
  27.  
  28. return 0;
  29. }
  30.  
  31.  
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
4+5+6+7+8=30