fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int all,cut,x;//all=總和,cut=次數,x=1加到x
  6. cut=0;
  7. cin>>x;
  8. while(cut<=x)
  9. {
  10. all=all+cut;
  11. cut++;
  12. }
  13. cout<<all<<","<<cut<<","<<x;
  14. return 0;
  15. }
Success #stdin #stdout 0.01s 5276KB
stdin
100
stdout
5050,101,100