Hallo,
ich soll ein Zahlenrätsel als Hausaufgabe von einem Programm lösen lassen die Grundidee habe ich auch schon aufgeschrieben und codiert allerdings stellt mich der auswurd der Console alles andere als zufrieden welchen Fehlerhabe ich gemacht?
public class ZahlenRaetsel
{
public static void main(String args[])
{
for ( int h = 0; h < 10; h++ )
{
for ( int e=0 ; e<10; e++)
{
for ( int s=0; s<10; s++)
{
for ( int t=0; t<10; t++)
{
for ( int b=0; b<10; b++)
{
int hes = 100 * h + 10 * e + s;
int the = 100 * t + 10 * h + e;
int best = 1000* b + 100 * e + 10 * s + t;
if ( (hes + the) == best)
System.out.println(best);
}
}
}
}
}
}
}
Greets
ich soll ein Zahlenrätsel als Hausaufgabe von einem Programm lösen lassen die Grundidee habe ich auch schon aufgeschrieben und codiert allerdings stellt mich der auswurd der Console alles andere als zufrieden welchen Fehlerhabe ich gemacht?
public class ZahlenRaetsel
{
public static void main(String args[])
{
for ( int h = 0; h < 10; h++ )
{
for ( int e=0 ; e<10; e++)
{
for ( int s=0; s<10; s++)
{
for ( int t=0; t<10; t++)
{
for ( int b=0; b<10; b++)
{
int hes = 100 * h + 10 * e + s;
int the = 100 * t + 10 * h + e;
int best = 1000* b + 100 * e + 10 * s + t;
if ( (hes + the) == best)
System.out.println(best);
}
}
}
}
}
}
}
Greets