Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int main()
  5. {
  6. int n;
  7. int s;
  8. cout << "Wartosc danej N: ";
  9. cin >> n;
  10. if(n > 0){
  11. s = n*(n+1)/2;
  12. cout << "S wynosi " << s;
  13. }else{
  14. cout << "n < 1 ";
  15. }
  16. return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement