Guest User

Untitled

a guest
Jan 22nd, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int a,b;
  6. cout << "Enter A: ";
  7. cin >> a;
  8. b=a;
  9. int sum=0;
  10. while(abs(b>0)){
  11. sum+=b%10;
  12. b/=10;
  13. }
  14. if (a * a == sum * sum * sum) {
  15. cout << "Yes, A*A equals to cube of sum of digits of A." << endl;
  16. } else {
  17. cout << "No, A*A is not equal to cube of sum of digits of A." << endl;
  18. }
  19. return 0;
  20. }
Add Comment
Please, Sign In to add comment