Skip to main content

Mark to Letter Grade Converter [C Programming]

#include <stdio.h>
void main()
{
    float a;
    printf("Enter marks: ");
    scanf("%f", &a);
    printf("Grade: ");
    if(a >= 90.0) printf("A+");
    else if(a >= 80.0) printf("A");
    else if(a >= 75.0) printf("B+");
    else if(a >= 70.0) printf("B");
    else if(a >= 65.0) printf("C+");
    else if(a >= 60.0) printf("C");
    else if(a >= 55.0) printf("D+");
    else if(a >= 50.0) printf("D");
    else printf("F");
}

Comments

Popular posts from this blog

Currency Converter - USD & BDT [C Programming]

#include <stdio.h> void main() {     int i;     float usd, bdt;     printf("Press 1 to convert USD to BDT\nPress 2 to convert BDT to USD\n");     printf("Enter your choice: ");     scanf("%d", &i);     switch(i)     {         case 1:             printf("Enter amount in USD: ");             scanf("%f", &usd);             bdt = usd * 80;             printf("1 USD = 80 BDT\n");             printf("%0.3f USD = %0.3f BDT", usd, bdt);             break;         case 2:   ...

Greatest Value Among Three Numbers [C Programming]

#include <stdio.h> void main() {     int a, b, c;     printf("Enter a number in a:");     scanf("%d", &a);     printf("Enter a number in b:");     scanf("%d", &b);     printf("Enter a number in c:");     scanf("%d", &c);     if(a >= b && a >= c) // a > b, a > c     {         printf("%d is largest", a);     }     else if(b >= a && b >= c) // b > a, b > c     {         printf("%d is largest", b);     }     else if(c >= a && c >= b) // c > a, c > b     {         printf("%d is largest", c);     } }