Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- bool suma(int n)
- {
- int sum = 0;
- int temp = 0;
- int n1 = n;
- while (n1 > 0)
- {
- temp=n1% 10;
- n1 /= 10;
- sum+= temp*temp*temp;
- temp = 0;
- }
- if (sum==n)
- return true;
- else
- return false;
- }
- void ispis(int n)
- {
- if (suma(n) == true)
- cout << "armstrongovi brojevi " << n<< endl;
- }
- int main()
- {
- int n;
- cout << "unesite neki broj "<< endl;
- cin >> n;
- if (n <200)
- {
- for (int i = 1; i < n; i++)
- ispis(i);
- }
- else
- cout << "broj veci od 200 " << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement