logoISU  

CS256 - Principles of Structured Design

Fall 2021

Displaying ./code/sternflCode/grd.c

#include<stdio.h>
/*
get a numerical grade from user
convert it to a letter grade  90 or above A
                              80 but not 90  B
                              70 but not 89  C
                             60  buty not 70  D
                             below 60   F
*/
int main() {
  float grd;
  printf("Enter the numerical grade ");
  scanf("%f", &grd);
  if (grd>=90)  printf("A\n");
  else if (grd>=80) printf("B\n");
  else if (grd>=70) printf("C\n");
  else if (grd>=60) printf("D\n");
  else printf("F\n");

  return 0;
}