Computer Science, asked by suparna7751, 5 months ago

Write a program in java to input name of a student, roll no. amd marks of 5 different subject. Now print his/her name, roll no. and percentage of marks obtained by the student​

Answers

Answered by aditya173662
2

Explanation:

import java.util.*;

class marks

{

public static void main ()

{

String name;int roll no., sub1,sub2,sub3,sub4,sub5,total marks,per=0;

System.out.println("Enter your detail and the marks of 5 subjects");

name=sc.nextLine();

roll no. =sc.nextInt();

sub1=sc.nextInt();

sub2=sc.nextInt();

sub3=sc.nextInt();

sub4=sc.nextInt();

sub5=sc.nextInt();

total marks=sc.nextInt();

per=((sub1+sub2+sub3+sub4+sub5)/total marks)*100;

System.out.println("Name:"+name+"roll no.:"+roll no.+"Marks of the 5 subjects:"+sub1+ "," +sub2+ "," +sub3+ "," +sub4+ "," +sub5+ ",");

System.out.println("Percentage obtained :" +per);

}

}

Similar questions