Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int n,a,suma_dziel;
  8.  
  9. cin>>n;
  10.  
  11.  
  12. for(int i=0;i<n;i++)
  13. {
  14. cin>>a;
  15. suma_dziel=0;
  16.  
  17. for(int j=1;j<a;j++)
  18. {
  19. if(a%j==0)
  20. {
  21. suma_dziel+=j;
  22. }
  23. }
  24. if(suma_dziel==a)
  25. {
  26. cout<<"Jest to liczba doskonala"<<endl;
  27. }
  28. if(suma_dziel<a)
  29. {
  30. cout<<"Jest to liczba nadmiarowa"<<endl;
  31. }
  32. if(suma_dziel>a)
  33. {
  34. cout<<"Jest to liczba deficytowa"<<endl;
  35. }
  36. }
  37.  
  38. return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement