Program Subject Total & Percentage


    import java.util.Scanner; 
    class Percentage 
    { 
      public static void main(String ar[]) 
      { 
        Scanner d = new Scanner(System.in); 

        System.out.println("Enter the marks of English: "); 
        int e = d.nextInt();

        System.out.println("Enter the marks of Physics: "); 
        int p = d.nextInt();

        System.out.println("Enter the marks of Chemistry: "); 
        int c = d.nextInt();

        System.out.println("Enter the marks of Biology: "); 
        int b = d.nextInt();

        System.out.println("Enter the marks of Arabic: "); 
        int a = d.nextInt();

        int t = e + p + c + b + a;

        System.out.println("Total = " + t); 

        double per = t / 5.0;

        System.out.println("Percentage is " + per); 
      } 
    }
    

Output: