Perdes

Untitled

Nov 19th, 2018
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. char GradeFromPercentage(float Ngrade, int assnum, int i);
  4.  
  5. int main(int argc, const char * argv[]) {
  6. // insert code here...
  7. //char Lgrade;
  8. printf("\n\n");
  9. printf("Welcome to the online grade centre program!\n");
  10. printf("\n\n");
  11. GradeFromPercentage(Ngrade, assnum, i);
  12. // GradeFromPercentage();
  13. return 0;
  14. }
  15.  
  16. char GradeFromPercentage(float Ngrade, int assnum, int i) {
  17.  
  18. printf("How many assignments are you entering a percentage for: ");
  19. scanf("%d", &assnum);
  20.  
  21. for (i=0; i < assnum; i++)
  22. {
  23. printf("Enter your grade percentage: ");
  24. scanf("%f", &Ngrade);
  25.  
  26. if (Ngrade>= 90) {
  27. printf("You grade is: A");
  28. } else if (Ngrade>= 70) {
  29. printf("You grade is: B");
  30. } else if (Ngrade>= 50) {
  31. printf("You grade is: C");
  32. }else if (Ngrade>= 30) {
  33. printf("You grade is: D");
  34. }else if (Ngrade< 30) {
  35. printf("You grade is: F");
  36. }else{
  37. printf("Invalid score, restart program.");
  38. }
  39. }
  40.  
  41. return Ngrade;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment