Advertisement
Guest User

Untitled

a guest
Jan 20th, 2020
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6. int kraniecdolny;
  7. int kraniecgorny;
  8. int sum=0;
  9. cout <<"podaj kraniec dolny: ", kraniecdolny;
  10. cin>> kraniecdolny;
  11. cout << "podaj kraniecgorny: ", kraniecgorny;
  12. cin >> kraniecgorny;
  13. for(int i=kraniecdolny; i<=kraniecgorny; i++)
  14. {
  15.  
  16. sum=sum+i;
  17. }
  18.  
  19. cout<< "suma to: "<< sum<<endl;
  20.  
  21.  
  22. bool czypodzielna = false;
  23. if(sum%7==0)
  24. {
  25. czypodzielna = true;
  26. }
  27. if(czypodzielna)
  28. {
  29. cout<< sum <<endl;
  30. }
  31.  
  32. return 0;
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement