C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
Program to calculate the CGPA percentageExplanationIn this program, we have to calculate the CGPA percentage of five subjects( English, Hindi, Maths, Science and Social Study). CGPA ( Cumulative Grade Point Average ) is the systematic arrangement in the educational stream to get average of grade points. And the CGPA percentage is 9.5 times the CGPA. CGPA = (Grades in all Subjects) / (Total Number of Subjects). So, CGPA= 9.5 × CGPA FormulaCGPA = 9.5 × CGPA Algorithm
ComplexityO(1) SolutionPython
English = 9.1
Hindi = 8.5
Maths = 9.5
Science =9.6;
SocialStudy = 8.6
CGPA = (9.1+8.5+9.5+9.6+8.6)/(5.0)
CGPAper = 9.5 * (CGPA)
print(" CGPA percentage is:");
print(CGPAper);
Output: CGPA percentage is: 86.07000000001 C
#include<stdio.h>
int main()
{
double English , Hindi ,Maths, Science, SocialStudy, CGPA , CGPAper ;
English = 9.1;
Hindi = 8.5;
Maths = 9.5;
Science =9.6;
SocialStudy = 8.6;
CGPA = (9.1+8.5+9.5+9.6+8.6)/(5.0);
CGPAper = (float)(9.5 * (CGPA));
printf("\n\n CGPA percentage is: %f",CGPAper);
return (0);
}
Output: CGPA percentage is: 86.070000 Java
public class CGPAProgram
{
public static void main (String args[])
{
double English, Hindi, Maths, Science, SocialStudy, CGPA, CGPAper ;
English = 9.1;
Hindi = 8.5;
Maths = 9.5;
Science =9.6;
SocialStudy = 8.6;
CGPA = (9.1+8.5+9.5+9.6+8.6)/(5.0);
CGPAper = (float)(9.5 * (CGPA));
System.out.println(" CGPA Percentage is: "+CGPAper);
}
}
Output: CGPA Percentage is: 86.06 C#
using System;
class Program
{ static void Main()
{
double English, Hindi, Maths, Science, SocialStudy, CGPA, CGPAper ;
English = 9.1;
Hindi = 8.5;
Maths = 9.5;
Science =9.6;
SocialStudy = 8.6;
CGPA = (9.1+8.5+9.5+9.6+8.6)/(5.0);
CGPAper = (float)(9.5 * (CGPA));
Console.WriteLine("CGPA percentage is:"+CGPAper);
}
}
Output: CGPA percentage is: 86.06 PHP
<?php
$English = 9.1;
$Hindi = 8.5;
$Maths = 9.5;
$Science =9.6;
$SocialStudy = 8.6;
$CGPA = (9.1+8.5+9.5+9.6+8.6)/(5.0);
$CGPAper = 9.5 * $CGPA;
echo("CGPA percentage is= ");
echo($CGPAper);
?>
Output: CGPA percentage is = 86.07
Next Topic#
|