Computer Science, asked by adityamishra3430, 8 months ago

Write a java program to input marks of 5 subjects of students and store them under array . calculate the total and average of the students

Answers

Answered by xSahiBx
13

Answer:

__________________________________

import java.util.Scanner;

public class Student_Marks

{

public static void main(String[] args)

{

int n, total = 0, percentage;

Scanner s = new Scanner(System.in);

System.out.print("Enter no. of subject:");

n = s.nextInt();

int marks[] = new int[n];

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

for(int i = 0; i < n; i++)

{

marks[i] = s.nextInt();

total = total + marks[i];

}

percentage = total / n;

System.out.println("Sum:"+total);

System.out.println("Percentage:"+percentage);

}

}

__________________________________

Attachments:
Answered by cuteangel0001
3

import java.util.Scanner;

public class Student_Marks

{

public static void main(String[] args)

{ {

int n, total = 0, percentage;

Scanner s = new Scanner(System.in);

System.out.print("Enter no. of subject:");

n = s.nextInt();

int marks[] = new int[n];

System.out.println("Enter marks out of

100:");

for(int i = 0; i <n; i++)

{

marks[i] = s.nextInt()3B

total = total + marks[i];

percentage = total / n;

System.out.println("Sum:"+total);

System.out.println("Percentage:"+percen

Attachments:
Similar questions