To show Number whose Cube is Equal to Sum of Cubes of Three Numbers Less than That Number e.g
D3=A3+B3+C3
=======================================================================
#include<iostream> using namespace std; main() { int a,b,c,d; int i,j,k; i=0; for(d=1;d<20;d++) { for(a=1;a<d;a++) { for(b=1;b<d;b++) { for(c=1;c<d;c++) { int aa,bb,cc,dd; aa=a*a*a; bb=b*b*b; cc=c*c*c; dd=d*d*d; if(aa+bb+cc==dd) { i=1; cout<<"For "<<d<<endl; cout<<a<<" "<<b<<" "<<c<<endl; break; } } if(i==1) { break; } } if(i==1) { break; } } i=0; } }
=========================================================================================
0 comments:
Post a Comment