[Solved] Language C: convert a number grade into a letter grade


Just use a string a look up the appropriate entry:

char convert(int numberGrade ){
   if (numberGrade >=0 && numberGrade  <= 20) {
           // 012345678901234567890      
      return "FFFFFFEEDDCCCBBBAAAAA"[numberGrade];
   }
   return 'X'
}

EDIT

Also you need to move the call to the convert function After you enter in the value.

See below:

int main(){
    int note;
    printf("Quelle est la note à convertir?\n");
    scanf("%d", &note);
    char lettre = convert(note);

    printf("%c\n", lettre);  // use %c with `char`, not %s
    return 0;
}

solved Language C: convert a number grade into a letter grade