Home
C Programming Language
_Tutorials
_Programs
Python Programming
Data Analytics
About Us
Contact Us
Privacy Policy
MyShop24
Geeky Session
Home
C Program
Program to calculate sum of 5 subjects and their percentage
Program to calculate sum of 5 subjects and their percentage
Geeky Session
Hello friends, in this example, you will learn how to calculate sum of 5 subjects and their percentage
in C programming language using following topics:
Data Type
s
Variables And Constants
Operator
s
#include
int main() { int s1,s2,s3,s4,s5,total; float percent; printf("Enter marks of five sub: \n"); scanf("%d%d%d%d%d"&s1,&s2,&s3,&s4,&s5); total= s1+s2+s3+s4+s5; percent (total/500)*100; printf("\nTotal marks= %d",total); printf("\nPercentage= %f",percent); return 0; }
Output:
E
nter marks of five sub:
84
76
65
90
70
Total marks= 385
Percentage= 77
Description of Program:
Input marks of five subjects in variables that say s1,s2,s3,s4 and s5.
Culculate sum of all subject and store it in total.
i.e, Total= s1+s2+s3+s4+s5.
Divide total marks of all subject by total number of subject or divid total marks of all subject divided by 500 and multiply them by 100 to find the percentage. i.e, (total marks/5)= %. Or (total marks/500)*100
= %
Overall, print the total values and percentage.
Post a Comment
2 Comments
Unknown
14/05/2020, 16:29
Nice
Reply
Delete
Replies
Reply
Unknown
16/05/2020, 16:28
Good job
Reply
Delete
Replies
Reply
Add comment
Load more...
Tutorials Series
Basic Of Computer
C Program
C Programming
Python Programming Language
Get a .NET @₹399/Yr
Contact Form
Name
Email
*
Message
*
Search Artical
Check Your Website
Translate
POPULAR POSTS
Paragraph In HTML
What Is Computer Programing Language And Classification Of Programming Language
Headings In HTML
Social Plugin
Popular Posts
Learn C Programming Language |
10/25/2019 02:25:00 pm
Functions in C Programming Language
12/03/2019 12:32:00 pm
What Is Computer Programing Language And Classification Of Programming Language
10/23/2019 07:43:00 pm
2 Comments
Nice
ReplyDeleteGood job
ReplyDelete