f the marks obtained by a student in a five different subject are input through the keyboard write a program to find the aggregate marks and percentage marks obtained by the student assume that the maximum marks that can be obtained by a student in a subject is 100. using for loop
Answers
Answer:
#include<stdio.h>
#include<conio.h>
void main()
{
int hindi, math, english, science, art, total;
float percentage;
printf("Enter the marks of Hindi: ");
scanf("%d", &hindi);
printf("Enter the marks of Math: ");
scanf("%d", &math);
printf("Enter the marks of English: ");
scanf("%d", &english);
printf("Enter the marks of Science: ");
scanf("%d", &science);
printf("Enter the marks of Art: ");
scanf("%d", &art);
total = hindi+math+english+science+art;
percentage = total/5;
printf("\nAggregate marks: %d", total);
printf("\nPercentage marks: %0.2f %%", percentage);
getch();
}
Answer:
java :-
Explanation:
import java.util.*;
class Brainly
{
static void main()
{
Scanner sc=new Scanner(System.in);
float m1,m2,m3,m4,m5,agg,per;
System.out.println(“Enter the marks:”);
m1=sc.nextFloat();
m2=sc.nextFloat();
m3=sc.nextFloat();
m4=sc.nextFloat();
m5=sc.nextFloat();
agg=m1+m2+m3+m4+m5;
per=agg/500*100;
System.out.println(“Aggregate:”+agg);
System.out.println(“Percentage:”+per);
}