Kodewick
Commencer à apprendre →
Bases←→0 / 70

Froid ou chaud

#014Basesreturn "cold"4 min

La carte météo n’affiche qu’un mot : en dessous de 10 degrés, "cold" ; à partir de 25, "hot" ; entre les deux, "mild". Écris weather_word(temp), qui renvoie le mot.

Exemples
weather_word(5)→'cold'
weather_word(18)→'mild'
weather_word(30)→'hot'
La fonctionconst char *weather_word(int temp)
main.c
const char *weather_word(int temp) {
    // ton code ici: sous 10 renvoie "cold"; à partir de 25 renvoie "hot"
    return "mild";
}
Ctrl + Entrée lance aussi le code
Résultat

Exécuter teste les exemples. Quand ils sont bons, appuie sur Envoyer.