Hei! So i found my problem with endless printing in my program, but the result is still not right. It should print out 1729 (12 + 1 = 9 + 10), but it doesn't.
Code:#include <iostream> using namespace std; int maks(int num1, int num2); int main() { int atgr,m,n,sk=13; for (int k=1; k<=sk; k++){ for (int l=1; l<=sk; l++){ for (int i=1; i<=sk; i++){ for (int j=1; j<=sk; j++){ m= k*k*k + l*l*l; n= j*j*j + i*i*i; //if(k!=l && k!=i && k!=j && l!=i && l!=j && i!=j){ // cout<<atgr;} } } } } atgr=maks(m,n); cout<<atgr<<endl; } int maks(int num1, int num2){ int m; if (num1==num2) m=num1; return m; }




Reply With Quote
