Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include <iostream >
  2.  
  3. int main()
  4. {
  5. int a, b;
  6. int s,s1 = 0;
  7. std::cout << "unesi broj : ";
  8. std::cin >> a;
  9. std::cout << b;
  10. std::cin >> b;
  11. while (a != 0) {
  12. s = s + a % 10;
  13. a = a / 10;
  14. }
  15. std::cin >> b;
  16. while (b != 0) {
  17. s1 = s1 + b % 10;
  18. b = b / 10;
  19. }
  20.  
  21. if (s ==s1)
  22. {
  23. std::cout << "brojevi " << a << " i " << b << "imaju isti zbroj znamenki koji iznosi " << s << std::endl;
  24. }
  25. else { std::cout << "brojevi nemaju isti zbroj znamenki"; }
  26. std::cin.get();
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement