fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6. int x,y=0;
  7. cin>>x;
  8. while(x>0){
  9. x--;
  10. y=y+x;
  11. }
  12. cout<<y;
  13. return 0;
  14. }
Success #stdin #stdout 0s 16064KB
stdin
5
stdout
10