program in which we calculate total marks in a course and print a course grade by using if-else conditions. However check, if user enters correct marks or not, for example midterm marks is between 0 to 20. If user enters midterm marks less than 0 or greater than 20 then print incorrect marks, please re-enter midterm marks. The same check will be tested with quiz, assignment, lab work and final marks. Then print total marks in a course that is greater than or equal to 0 and less than or equal to 100. Marks distribution as:
Midterm 0-20
Quiz 0-5
Assignment 0-5
Lab Work 0-20
Final 0-50
90 or greater = Grade A
80-89.99 = Grade B
70-79.99 = Grade C
60-69.99 = Grade D
59.99 or lower = Grade F
Here is more detail output screen:
Display: Enter midterm marks:
Input: 15
Display: Enter quiz marks:
Input: 10
Display: You have entered incorrect marks of quiz, please re-enter quiz marks:
Input: 5
Display: Enter assignment marks:
Input: 6
Display: You have entered incorrect marks of assignment, please re-enter assignment marks:
Input: 10
Display: You have entered incorrect marks of assignment, please re-enter assignment marks:
Input: 50
Display: You have entered incorrect marks of assignment, please re-enter assignment marks:
Input: 3
Display: Enter lab marks:
.
.
.
Hint: Quite many if else conditions will be used. Use while or do-while loops to take re-input.
Recommended Answers
Jump to PostLooks like a homework assignment.
It is expected of members to at least try to code something themselves
before asking for help.You do that, and you will find a lot of very knowledgable and helpful members
willing to help you.
Jump to Posthey, i tried a lot, i made it all
I see no code to show us what you tried so therefore cannot help you fix it.
Unless, of course, you want us to write it for you...
Jump to PostTo simply have it continue to loop only if the entry is below 20
you should use the keyword break; after printf("yes");Cut you continue; statement out and replace printf("No"); with it.
Jump to PostBetter yet, have the
while
loop test if a good value was entered. Then you wouldn't need theif
at all.Also format your code. If you want help, the people you are …
All 15 Replies
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.