Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- int main ()
- {
- std::cout<<"Unesite dva cijela broja: ";
- int a,b, s(1);
- bool t (true);
- std::cin>>a>>b;
- a+=1;
- for (a; a<=b-1; a++)
- {
- for(int i=2; i<=a-1; i++)
- if((a%i)==0) s+=i;
- if (s==a)
- {
- std::cout<<a<<" ";
- t=false;
- }
- s=1;
- }
- if (t) std::cout<<"Nema savrsenih brojeva.";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement