My house's number can be written
as ABCD but it also equals to
A^B * C^D.
Find the number ..-no computer programs!!!
(In reply to
re: Poor AWK people... by Erik O.)
#include <cmath>
main {
for (int a=0; a!=10; a++)
for (int b=0; b!=10; b++)
for (int c=0; c!=10; c++)
for (int d=0; d!=10; d++)
if ( ( (int)pow(a,b) * (int)pow(c,d) ) == (a*1000 + b*100 + c*10 + d) )
return (a*1000 + b*100 + c*10 + d);
return (-1);}
And I included the return statements and declared all the variables!
Edited on June 21, 2004, 4:51 pm
|
Posted by Thalamus
on 2004-06-21 16:41:33 |