nb2←a³+b³+c³
Si nb1=nb2 Alors
Ecrire nb1,a,b,c
FinSI
Jusqu’à c=10
Jusqu’à b=10
Jusqu’à a=10
Fin
En Java :
class chap4_troisboucles2 {
public static void main(String[] args) {
double x,y,z,nb1,nb2;
x=1;
do {
y=1;
do {
z=1;
do {
nb1=x*100+y*10+z;
nb2=Math.pow(x,3)+Math.pow(y,3)+Math.pow(z,3);
if(nb1==nb2) {
System.out.println(nb1+"="+nb2+", "+x+" "+y+" "+z);
}
z++;
}while(z<=10);
y++;
}while(y<=10);
x++;
}while(x<=10);
}
}
- 3 -
© ENI Editions - All rigths reserved - Jonifar lina
88
Si nb1=nb2 Alors
Ecrire nb1,a,b,c
FinSI
Jusqu’à c=10
Jusqu’à b=10
Jusqu’à a=10
Fin
En Java :
class chap4_troisboucles2 {
public static void main(String[] args) {
double x,y,z,nb1,nb2;
x=1;
do {
y=1;
do {
z=1;
do {
nb1=x*100+y*10+z;
nb2=Math.pow(x,3)+Math.pow(y,3)+Math.pow(z,3);
if(nb1==nb2) {
System.out.println(nb1+"="+nb2+", "+x+" "+y+" "+z);
}
z++;
}while(z<=10);
y++;
}while(y<=10);
x++;
}while(x<=10);
}
}
- 3 -
© ENI Editions - All rigths reserved - Jonifar lina
88
