Computer Science, asked by Ehsanul9970, 6 months ago

Input marks of any three subjects to find the total and average marks of one student
give me the answer please of basic program

Answers

Answered by keyboardavro
2

Answer:

Explanation:

import java.util.Scanner;

class student

{

public static void main(String[]args)

{

Scanner in = new Scanner(System.in);

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

String name = in.nextLine();

System.out.println("Enter your subject 1 marks");

int m1 = in.nextInt();

System.out.println("Enter your subject 2 marks");

int m2 = in.nextInt();

System.out.println("Enter your subject 3 marks");

int m3 = in.nextInt();

System.out.println("Enter your subject 4 marks");

int m4 = in.nextInt();

double total = m1+m2+m3+m4;

double avg = total/4.0; //the reason why we are writing 4.0 is because we have declared avg to be of a double datatype

System.out.println("Your details:");

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

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

System.out.println("Average of the given marks: " + avg);

}

}

Answered by Anonymous
0

\huge\mathcal{\underline{\color{aqua}Answer ➡}}

Input : file[] = {“Shrikanth”, “20”, “30”, “10”, “Ram”, “100”, “50”, “10”}

Output : Ram 53

Average scores of Shrikanth, Ram are 20 and 53 respectively. So Ram has the maximum average score of 53.

Input : file[] = {“Ramesh”, “90”, “70”, “40”, “Adam”, “50”, “10”,

            ”40″, “Suresh”, “22”, “1”, “56”, “Rocky”, “100”, “90”, “10”}

Output : Ramesh Rocky 66

Average scores of Ramesh, Adam, Suresh and Rocky are 66, 33, 26 and 66 respectively. So both Ramesh and Rocky have the maximum average score of 66.

Similar questions