Calculate Sum of 5 Subjects and Find Percentage : C Program

Computer Science » C Program » Calculate Sum of 5 Subjects and Find Percentage

Program :

#include<stdio.h>
 
int main() 
{
   int s1, s2, s3, s4, s5, sum, total = 500;
   float percentage;
 
   printf("nEnter marks of 5 subjects : ");
   scanf("%d %d %d %d %d", &s1, &s2, &s3, &s4, &s5);
 
   sum = s1 + s2 + s3 + s4 + s5;
   printf("nSum : %d", sum);
 
   percentage = (sum * 100) / total;
   printf("nPercentage : %f", percentage);
 
   return (0);
}

Output :

Enter marks of 5 subjects : 90 70 90 80 70
Sum : 400
Percentage : 80.00
Subject Name : Computer Science
Exam Name : IIT GATE, UPSC ESE, RRB, SSC, DMRC, NMRC, BSNL, DRDO, ISRO, BARC, NIELIT
Posts Name : Assistant Engineer, Management Trainee, Junior Engineer, Technical Assistant
Computer Science Books

GATE 2023 Total InfoENGG DIPLOMAUGC NET Total Info
IES 2023 Total InfoPSUs 2022 Total InfoCSIR UGC NET Total Info
JAM 2023 Total InfoM TECH 2023 Total InfoRAILWAY 2022 Total Info

Related Posts

  • C Program ExamplesComputer Science » C Program » C Program Examples "How to print hello, world! using c program ? How to find area of a circle using c program ? How to find smallest element in an array using c program ? You all must have this kind of questions in your mind. Below article will solve this puzzle of yours. Just take a look.”  - Here we have listed all the programs in C programming language, categorised under different progamming concepts like Basic, Area, Mathematical, Number, Array etc. Check the respective category to view all the programs under that category. C Programs - Basic C Programs C Programs - Number Programs C Programs - Area Programs C Programs - Mathematical Programs C Programs - Array Programs C Programs - Electrical Programs C Programs - Pyramid Programs
    Tags: programs, program, computer, science
  • Find greatest in 3 numbers : C ProgramComputer Science » C Program » Find greatest in 3 numbers  Program : [php]#include&lt;stdio.h&gt; int main() { int a, b, c; printf(&quot;nEnter value of a, b &amp; c : &quot;); scanf(&quot;%d %d %d&quot;, &amp;a, &amp;b, &amp;c); if ((a &gt; b) &amp;&amp; (a &gt; c)) printf(&quot;na is greatest&quot;); if ((b &gt; c) &amp;&amp; (b &gt; a)) printf(&quot;nb is greatest&quot;); if ((c &gt; a) &amp;&amp; (c &gt; b)) printf(&quot;nc is greatest&quot;); return(0); }[/php] Output : [php]Enter value for a,b &amp; c : 12 16 20 c is greatest[/php]
    Tags: program, find, computer, science, output, programs
  • Find sum of Two Integer Numbers : C ProgramComputer Science » C Program » Find sum of Two Integer Numbers Program : [php]#include<stdio.h> int main() { int a, b, sum; printf("Enter the two numbers : "); scanf("%d %d", &a, &b); sum = a + b; printf("nSum of %d and %d is : %d", a,b,sum); return(0); }[/php] Output : [php]Enter the two numbers : 2 4 Sum of 2 and 4 is : 6[/php]
    Tags: program, find, sum, computer, science, output, programs
  • Find Sum of Digits of a Number : C ProgramComputer Science » C Program » Find Sum of Digits of a Number Program : [php]#include <stdio.h> int main() { long number, digit, sum = 0; printf("Enter the number :"); scanf("%ld", &number); while (number > 0) { digit = number % 10; sum = sum + digit; number = number / 10; } printf("nSum of the digits of given number is : %ld", sum); }[/php] Output : [php]Enter the number : 2882 Sum of the digits of given number is : 20[/php]
    Tags: program, find, sum, computer, science, output, programs
  • Calculate Sum of Odd and Even Numbers : C ProgramComputer Science » C Program » Calculate Sum of Odd and Even Numbers Program : [php]#include <stdio.h> int main() { int i, n; int sum_odd = 0, sum_even = 0; printf("Enter the number up to which you want to calculate sum : "); scanf("%d", &n); for (i = 1; i <= n; i++) { if (i % 2 == 0) sum_even = sum_even + i; else sum_odd = sum_odd + i; } printf("nSum of all even numbers is : %d", sum_even); printf("nSum of all odd numbers is : %d", sum_odd); }[/php] Output : [php]Enter the number up to which you want to calculate sum : 100 Sum of all even numbers is : 2550 Sum of all odd numbers is : 2500[/php]
    Tags: program, calculate, sum, computer, science, output, programs

LEAVE A REPLY

Please enter your comment!
Please enter your name here