Parcours
/
MIPS Assembly
MIPS Assembly
/
Exercices
/
La chanson des bouteilles
La chanson des bouteilles

La chanson des bouteilles

Moyen

Instructions

Récite les paroles de cette célèbre chanson répétitive pour enfants : Ten Green Bottles.

Note que tous les couplets ne sont pas identiques.

Ten green bottles hanging on the wall,
Ten green bottles hanging on the wall,
And if one green bottle should accidentally fall,
There'll be nine green bottles hanging on the wall.

Nine green bottles hanging on the wall,
Nine green bottles hanging on the wall,
And if one green bottle should accidentally fall,
There'll be eight green bottles hanging on the wall.

Eight green bottles hanging on the wall,
Eight green bottles hanging on the wall,
And if one green bottle should accidentally fall,
There'll be seven green bottles hanging on the wall.

Seven green bottles hanging on the wall,
Seven green bottles hanging on the wall,
And if one green bottle should accidentally fall,
There'll be six green bottles hanging on the wall.

Six green bottles hanging on the wall,
Six green bottles hanging on the wall,
And if one green bottle should accidentally fall,
There'll be five green bottles hanging on the wall.

Five green bottles hanging on the wall,
Five green bottles hanging on the wall,
And if one green bottle should accidentally fall,
There'll be four green bottles hanging on the wall.

Four green bottles hanging on the wall,
Four green bottles hanging on the wall,
And if one green bottle should accidentally fall,
There'll be three green bottles hanging on the wall.

Three green bottles hanging on the wall,
Three green bottles hanging on the wall,
And if one green bottle should accidentally fall,
There'll be two green bottles hanging on the wall.

Two green bottles hanging on the wall,
Two green bottles hanging on the wall,
And if one green bottle should accidentally fall,
There'll be one green bottle hanging on the wall.

One green bottle hanging on the wall,
One green bottle hanging on the wall,
And if one green bottle should accidentally fall,
There'll be no green bottles hanging on the wall.

Format de sortie

Produis les paroles sous la forme d'une chaîne de caractères terminée par un caractère nul.

Registres

Registre Utilisation Type Description
$a0 entrée entier bouteilles au départ
$a1 entrée entier bouteilles à retirer
$a2 entrée/sortie adresse chaîne de sortie terminée par un caractère nul
$t0-9 temporaire quelconque pour le stockage temporaire

Source

WikipediaLe lien s'ouvre dans une nouvelle fenêtre ou un nouvel onglet
Modifie via GitHub Le lien s'ouvre dans une nouvelle fenêtre ou un nouvel onglet
MIPS Assembly Exercism

Prêt à commencer La chanson des bouteilles ?

Inscris-toi sur Exercism pour apprendre et maîtriser MIPS Assembly avec 70 exercices, et un vrai mentorat humain, le tout gratuitement.