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

Write a C Program To Take Input of 5 Subject, Find Total And Calculate Percent

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

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.

Jeetu Sahu is A Web Developer | Computer Engineer | Passionate about Coding, Competitive Programming, and Blogging

2 thoughts on “C Program To Take Input of 5 Subject, Find Total And Calculate Percent”

  1. 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

    Reply

Leave a Comment

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.