C Program To Take Input of 5 Subject, Find Total And Calculate Percent
In this article, we are going to write a c program to Take Input of 5 Subject and find total and calculate percent. On the basis of percent provide grades like :
IF Per > 80 “A+”
Per >= 65 and per <=80 “A”
Per > =50 and per <=65 “B”
Per >= 42 and per <=50 “C”
Per < 42 “Fail”
To make this program, we will use the following concept -:
If you do not know about these topics well, then you may not understand this program, so you should know about them in detail from the link given above.
Now without wasting time let’s start programming.
Write a C Program To Take Input of 5 Subject, Find Total And Calculate Percent
Algorithm
- Start
- Declaration of variable
- Enter the subject marks
- Assign the value in variable
- Check condition
- Give answer according to condition
- Stop
Flowchart
Program
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c,d,e,total;
float per;
printf("enter your marks");
scanf("%d %d %d %d %d",&a,&b,&c,&d,&e);
total=a+b+c+d+e;
printf("\ntotal marks is %d\n",total);
per=total*100/(5.0*100);
printf("percent is %f\n",per);
if(per>80)
printf("A+");
else{ if(per>=65&&per<=80)
printf("A");
else { if(per>=50&&per <=65 )
printf("B");
else { if(per >= 42 && per <=50 )
printf("C");
else
printf("Fail");
}
}
}
getch();
}
Output
Enter Your Marks 56 76 67 87 80
Total marks is 336
Percent is 73.199997
A
Read More
- Download C Language Notes Pdf
- C Language Tutorial For Beginners
- C Programming Examples With Output
- 250+ C Programs for Practice PDF Free Download
Conclusion
In this article, we have created all the following programs -:
- Write a C Program To Take Input of 5 Subject, Find Total And Calculate Percent
If you have difficulty to understand any program or have any doubts or questions, then tell me in the comment below.
I need further explanation on certain areas in your c exercises you have provided
I just started studying c programming with an online course however the notes I got are too shallow
Can you send me exercises in pdf format with output so I can do them over and over until I understand the concepts in c
I noted that your lessons are helpful to me
check it out -> https://cstutorialpoint.com/c-programming-examples/