Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. // ConsoleApplication3.cpp : This file contains the 'main' function. Program execution begins and ends there.
  2. //
  3.  
  4. #include "pch.h"
  5. #include <iostream>
  6. using namespace std;
  7. int main()
  8. {
  9. int x, y;
  10. cout << "iveskite intervala tokiu formatu x y" << endl;
  11. cin >> x >> y;
  12. for (int i = x; i <= y; i++)
  13. {
  14. int suma = 0;
  15. for (int j = 1; j <= i / 2; j++)
  16. {
  17. if (i % j == 0)
  18. {
  19. suma += j;
  20. }
  21. }
  22. if (suma == i)
  23. {
  24. cout << suma << " ";
  25. }
  26. }
  27.  
  28. }
  29.  
  30. // Run program: Ctrl + F5 or Debug > Start Without Debugging menu
  31. // Debug program: F5 or Debug > Start Debugging menu
  32.  
  33. // Tips for Getting Started:
  34. // 1. Use the Solution Explorer window to add/manage files
  35. // 2. Use the Team Explorer window to connect to source control
  36. // 3. Use the Output window to see build output and other messages
  37. // 4. Use the Error List window to view errors
  38. // 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
  39. // 6. In the future, to open this project again, go to File > Open > Project and select the .sln file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement