Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n, c1, c2, c3, s;
- cout<<"Introduceti numarul de 3 cifre, n=";cin>>n;
- c1=n%10;
- c2=(n/10)%10;
- c3=n/100;
- s=c1*c1+c2*c2+c3*c3;
- if(n==s)
- cout<<"Numarul este egal cu suma patratelor cifrelor sale";
- else
- cout<<"Numarul nu este egal cu suma patratelor cifrelor sale";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment