Skip to content

Instantly share code, notes, and snippets.

@swimmi
Created April 21, 2014 11:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save swimmi/11140339 to your computer and use it in GitHub Desktop.
Save swimmi/11140339 to your computer and use it in GitHub Desktop.
Is this a daffodil number?
#include <fstream>
#include <iostream>
using namespace std;
//Is this a daffodil number?
int main()
{
//ifstream cin("daffodil_number.txt");
int num;
while(cin>>num)
{
int h=num/100;
int t=num%100/10;
int c=num%10;
cout<<(h*h*h+t*t*t+c*c*c==num?"Yes":"No")<<endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment