Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int main()
- {
- int lb, suma=0;
- cout << "Ahoj! Sprawdzmy, czy twoja liczba jest doskonala! Podaj liczbe: ";
- cin >> lb;
- for(int i=1; i<lb; i++)
- {
- if(lb%i==0)
- {
- //cout << i << " jest dzielnikiem liczby ktora wprowadziles" << endl;
- suma=suma+i;
- //cout << "Suma ich wynosi: " << suma << endl;
- }
- }
- if(suma==lb)
- cout << "Twoja liczba jest doskonala!" << endl;
- else
- cout << "Jeszcze nie jest Toba! Do doskonalosci jej daleko...";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement