Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- char GradeFromPercentage(float Ngrade, int assnum, int i);
- int main(int argc, const char * argv[]) {
- // insert code here...
- //char Lgrade;
- printf("\n\n");
- printf("Welcome to the online grade centre program!\n");
- printf("\n\n");
- GradeFromPercentage(Ngrade, assnum, i);
- // GradeFromPercentage();
- return 0;
- }
- char GradeFromPercentage(float Ngrade, int assnum, int i) {
- printf("How many assignments are you entering a percentage for: ");
- scanf("%d", &assnum);
- for (i=0; i < assnum; i++)
- {
- printf("Enter your grade percentage: ");
- scanf("%f", &Ngrade);
- if (Ngrade>= 90) {
- printf("You grade is: A");
- } else if (Ngrade>= 70) {
- printf("You grade is: B");
- } else if (Ngrade>= 50) {
- printf("You grade is: C");
- }else if (Ngrade>= 30) {
- printf("You grade is: D");
- }else if (Ngrade< 30) {
- printf("You grade is: F");
- }else{
- printf("Invalid score, restart program.");
- }
- }
- return Ngrade;
- }
Advertisement
Add Comment
Please, Sign In to add comment