Created
June 23, 2022 15:07
-
-
Save DeclanGas/f84aa40f65a8d92fb8795f802343be99 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cs50.h> | |
#include <stdio.h> | |
int main(void) | |
{ | |
// Get grade as a number | |
int grade = get_int("Enter your grade: "); | |
// grades between 90 and 100 get an A | |
if (grade > 89 && grade < 101) | |
{ | |
printf("You get an A!\n"); | |
} | |
// grades between 80 and 89 get a B | |
if (grade > 79 && grade < 90) | |
{ | |
printf("You get a B!\n"); | |
} | |
// only grades between 70 and 79 get a C | |
if (grade > 69 && grade < 80) | |
{ | |
printf("You get a C!\n"); | |
} | |
// all other need improvement | |
if (grade < 70) | |
{ | |
printf("You need to work harder to pass this class!\n"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment