Advertisement
Guest User

Untitled

a guest
Nov 28th, 2014
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. #include <iostream>
  2. int main()
  3. {
  4. std::cout << "wirte two numbers:" << std::endl;
  5. int start = 0, end = 0;
  6. std::cin >> start >> end;
  7. int sum = 0;
  8. while (start <= end) {
  9. sum += start;
  10. ++start;
  11. }
  12. std::cout << "Sum of 1 to 10 inclusive is "
  13. << sum << std::endl;
  14. return 0;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement