Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Assignment 4 For this assignment, we will move on to Chapter 4. In this chapter,

ID: 641366 • Letter: A

Question

Assignment 4

For this assignment, we will move on to Chapter 4. In this chapter, we learn about using breaking and

continuing statements. These statements are very important when you have a set number of times you

want your check statement to run. For instance, some programs, you do not want to have the user type

a negative 1 to end the statement. You just want it to run a certain number of times and then move on.

This is what this chapter mainly deals with. We have for / next statements, while statements, and do /

while statements that have a certain number of times they will run. You will start using these more and

more as you progress in your coding skills.

For assignment 4, we will be expanding on assignment 3. However, for this assignment, instead of

having the user type in -1 to stop the code, I am looking to have the user input 10 grades in your

program. I need 10 grades to be entered, with each line that prints out telling me what grade I am on.

When you finish entering 10 grades, the program needs to calculate the percentage. Finally, from that

percentage, we will show the student whether or not if they are passing the class.

Explanation / Answer

I did not understand the meaning of grade. How shall we calculate percentage with only grades available with us. Grades means A, A+, B, C etc. Right ?

I m writing here a program in C to input 10 subjects marks and calculate percent and result of student. Hope this helps.

/* We assume total marks is 1000*/


#include<stdio.h>
int main()
{
float m1,m2,m3,m4,m5,m6,m7,m8,m9,m10, avg,per; //m=marks
printf("Enter 10 subject marks: ");
scanf("%f %f %f %f %f%f %f %f %f %f",&m1,&m2,&m3,&m4,&m5,&m6,&m7,&m8,&m9,&m10);
per = (m1+m2+m3+m4+m5+m6+m7+m8+m9+m10)*100/1000;
printf("Student get %0.2f percentage. ",per);
if(per>=60)
printf("You pass with 1st Division");
else if(per>=50 && per<=59)
printf("You pass with 2nd Division");
else if(per>=40 && per<=49)
printf("You pass with 3rd Division");
else if(per<40)
printf("You Fail");
return 0;
}