Monday, June 14, 2021

java program put the marks and calculate the percentage (Java) (167)

package com.company;
import java.util.Scanner;
public class Program4 {
public static void main(String[] args) {
System.out.println("percentege calculator");
Scanner per=new Scanner(System.in);
System.out.println("enter marks of computer science (out of 100):");
int a=per.nextInt();
System.out.println("enter marks of english (out of 100):");
int b=per.nextInt();
System.out.println("enter marks of math (out of 100):");
int c=per.nextInt();
System.out.println("enter marks of physics (out of 100):");
int d=per.nextInt();
System.out.println("enter marks of chemistry (out of 100):");
int e=per.nextInt();
int sum=a+b+c+d+e;
System.out.print("total marks from all subjects are:");
System.out.println(sum);
float percentage=sum*100/5;
System.out.println("your percentagge is:");
System.out.println(percentage);
}
}

No comments:

Post a Comment