//Write a program to calculate the percentage of marks of five subject


package com.company;

import java.util.Scanner;

public class Main {

public static void main(String[] args) {
System.out.println("CBSE student percentage calculator");
System.out.println("enter your marks");
System.out.print("maths:");
Scanner sc = new Scanner(System.in);
int sub1 = sc.nextInt();
System.out.print("english:");
int sub2 = sc.nextInt();
System.out.print("computer:");
int sub3 = sc.nextInt();
System.out.print("chemistry:");
int sub4 = sc.nextInt();
System.out.print("history:");
int sub5 = sc.nextInt();
System.out.print("The percentage of student:");
int sum = sub1 + sub2 + sub3 + sub4 + sub5;
int total = 500;
float per =(float) ( sum * 100)/total;
System.out.println(per);

}}
//output
CBSE student percentage calculator
enter your marks
maths:90
english:89
computer:89
chemistry:78
history:67
The percentage of student:82.6

Process finished with exit code 0

Post a Comment

0 Comments