Computer Science, asked by MITALIPHADNIS, 3 months ago

Using Scanner, input name, class, div, roll number and marks in three subjects of a student. Calculate total and average if grand total is 300. Print student name , total and average.

Answers

Answered by Rachel2004
5

Answer:

import java.util.Scanner;

public class Marks

{

     public static void main()

   {

           Scanner sc=new Scanner(System.in);

           System.out.println("Enter name :");

           String name= sc.nextLine();

           System.out.println("Enter Class :");

           int std = sc.nextInt();

           System.out.println("Enter Division :");

           int div = sc.nextInt();

           System.out.println("Enter Roll no. :");

           int roll = sc.nextInt();

          System.out.println("Enter marks of English :");

          double m1= sc.nextDouble();

          System.out.println("Enter marks of Maths :");

           double m2= sc.nextDouble();

           System.out.println("Enter marks of Computer :");

           double m3= sc.nextDouble();

           double total = m1+m2+m3;

           double avg = total/3.0 ;

           

          System.out.println("Name : "+name);

          System.out.println("Total "+ total);    

         System.out.println("Average : "+avg);  

   }

}

Similar questions