Browse Source

refactoring: optimierung der tierfakten funktion durch else if

remotes/origin/zahlenratendev
fdai7754 11 months ago
parent
commit
25ae267ef2
  1. 14
      src/ageinseconds.c

14
src/ageinseconds.c

@ -35,31 +35,31 @@ int tierfakten(int age) {
printf("%s", fakt[0]);
}
if (age <= 6 && age > 4) {
else if (age <= 6 && age > 4) {
printf("%s", fakt[1]);
}
if (age <= 14 && age > 6) {
else if (age <= 14 && age > 6) {
printf("%s", fakt[2]);
}
if (age <= 20 && age > 14) {
else if (age <= 20 && age > 14) {
printf("%s", fakt[3]);
}
if (age <= 29 && age > 20) {
else if (age <= 29 && age > 20) {
printf("%s", fakt[4]);
}
if (age <= 47 && age > 29) {
else if (age <= 47 && age > 29) {
printf("%s", fakt[5]);
}
if (age <= 95 && age > 47) {
else if (age <= 95 && age > 47) {
printf("%s", fakt[6]);
}
if (age > 95) {
else {
printf("%s", fakt[7]);
}

Loading…
Cancel
Save