Computer Science, asked by mrmontukumar95, 8 months ago

Write a program which prompts the user to enter the number of subjects. Now read the marks of all the subjects from the user using scanner class. Write a method which calculates the percentage of the user

Answers

Answered by vicky8764
0

Answer:

import java.util.*;

class subject

{

public static void main()

{

Scanner in = new Scanner(System.in);

System.out.println("Entre the number of subjects");

int k=in.nextInt();

int s=0;

for(int i=1;i<=k;i++)

{

System.out.println("Enter the marks");

int t=in.nextInt();

s=s+t;

}

System.out.println("Your percentage is" + (s/k));

}

}

Similar questions