In bluej Write program to input name, roll no, class and mark of 3 subject
Answers
import java.util.*;
class Student
{
public static void main()
{
Scanner Sc=new Scanner(System.in); System.out.println(“Enter roll no “);
int roll=Sc.nextInt();
System.out.println(“Enter the marks in three subjects and fullmarks “);
double m1=Sc.nextDouble();
double m2=Sc.nextDouble();
double m3=Sc.nextDouble();
double fullmark=Sc.nextDouble();
{
double total=m1+m2+m3;
double percent=total/fullmark*100; }
{ System.out.println(“Roll number: “+roll); }
{ System.out.println(“Marks in first subject: “+m1); }
{ System.out.println(“Marks in second subject: “+m2); }
{ System.out.println(“Marks in third subject: “m3); }
{ System.out.println(“Total marks scored: “+total); }
{ System.out.println(“Percentage scored: “+percent);
} } }
Output: Enter roll no 11
Enter the marks in three subjects and fullmarks 80 80 90
Roll number: 11
Marks in first subject: 80
Marks in second subject: 80
Marks in third subject: 90
Total marks scored: 250
Percentage scored:83.33