Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int i, suma=0, p, uc, k, n;
- cout<<"k="; cin>>k;
- for(i=1; i<=k; i++)
- {
- n=i;
- suma=0;
- while(n!=0)
- {
- uc=n%10;
- suma=suma+uc;
- n=n/10;
- }
- p=suma*suma;
- if(p==i)
- cout<<"Nr este:"<<i<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement