|
-
December 14th, 2013, 03:04 PM
#1
need a little help
Heyy!
I just started learning programing and there is a little assigment that i need to do, but i cant figure out why my program is not doing what it should do. If i look at it, everything seems correct, but when i try to run it, it never stops.
I have to find minimal number m, where m=a^3+b^3=c^3+d^3. It should print out 1729, but it doesnt.
No idea how to fix this.    
Code:
#include <iostream>
using namespace std;
int maks(int num1, int num2);
int main()
{
int atgr,m,n,sk=100;
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);
}
int maks(int num1, int num2){
int m;
if (num1==num2) m=num1;
return m;
}
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|