Computer Science, asked by SupriyaSahoo, 1 year ago

write a program to assign student name and 4 subject marks, Print name, roll number, total mark and average mark with appreciate message.

Answers

Answered by RishabhRKO
5
import java.util.*;
class Dcoder
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
String name;
int rn, m1, m2, m3, m4, total;
double avg;

System.out.println("Enter your name");
name=in.nextLine();
System.out.println ("Enter your Roll Number");
rn=in.nextInt();
System.out.println ("Enter marks in first subject");
m1=in.nextInt();
System.out.println ("Enter marks in second subject");
m2=in.nextInt();
System.out.println ("Enter marks in third subject");
m3=in.nextInt();
System.out.println ("Enter marks in fourth subject");
m4=in.nextInt();

total= m1+m2+m3+m4;
avg= total/4;

System.out.println("Student name:"+name);
System.out.println ("Student Roll number:"+rn);
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 ("Marks in fourth subject="+m4);
System.out.println ("Total marks ="+total);
System.out.println ("Average marks="+avg);
System.out.println ("Congratulations for the result.Keep it up");
}
}
Similar questions