title: C Program Convert float number to letter grade
body: <p>Hi I am trying to write a program that asks the user for a numeric grade and then converts this to a letter grade basically from a float to a string, I kind of have this working apart from when the grade is say B+ it only returns +. I know this is because I am returning char which is only one character. I have tried changing char letterGrade to char letterGrade[3]; but this gives me the error: incompatible types when assigning to type char[3] from type int. Appreciate if someone could tell me where I am going wrong as I am very new to this.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  
   struct module {
    char moduleid[10];
    int credit;
    float grade;
   };
    //Convert numeric grade to letter grade
    char getGrade (float input){
      char letterGrade[3];
      if(input &gt;= 80&amp;&amp;input&lt;=100)
          letterGrade = 'A';
  
      else if(input &gt;= 70&amp;&amp;input&lt;=79)
          letterGrade = 'B+';
  
      else if(input &gt;= 60&amp;&amp;input&lt;=69)
          letterGrade = 'B';
  
      else if(input &gt;= 55&amp;&amp;input&lt;=59)
          letterGrade = 'B-';
  
      else if(input &gt;= 50&amp;&amp;input&lt;=54)
          letterGrade = 'c+';
  
      else if(input &gt;= 40&amp;&amp;input&lt;=49)
          letterGrade = 'c';
  
      else if(input &gt;= 35&amp;&amp;input&lt;=39)
          letterGrade = 'D';
  
      else
          letterGrade = 'F';
  
     return letterGrade;
     }
  
    int main( ) {
        struct module mod1,mod2;
        printf("Please enter: module id, module credit and module grade\n");
        scanf("%s%d%f",mod1.moduleid,&amp;mod1.credit,&amp;mod1.grade);
        scanf("%s%d%f",mod2.moduleid,&amp;mod2.credit,&amp;mod2.grade);
  
        printf( "Module id\tCredit\t\tGrade\n");
        printf("%s\t\t%d\t\t%f\t%s\n",mod1.moduleid,mod1.credit,mod1.grade,getGrade(mod1.grade));
        printf( "%s\t\t%d\t\t%f\t%s\n",mod2.moduleid,mod2.credit,mod2.grade,getGrade(mod2.grade));
  
        return 0;
     }
  </code></pre>