import java.io.*;
class ReadKeyboard
{
public static void
main(String args[])
throws
IOException
{
char
c;
BufferedReader
br=new BufferedReader(newInputStreamReader(System.in));
DataInputStream
in=new DataInputStream(System.in);
String name;
int number,total=0;
int marks[]=new int[5];
try
{
System.out.println("Enter
Student Name:");
name=br.readLine();
System.out.println("Enter
Number :");
number=Integer.parseInt(in.readLine());
for(int
j=0;j<5;j++)
{
System.out.println("Enter
Subject" + (j+1)+" Marks");
marks[j]=Integer.parseInt(in.readLine());
total=total+marks[j];
}
System.out.println("Student
Name : "+name);
System.out.println("Student
Number : "+number);
System.out.println("student
Total marks: "+total);
System.out.println("Student
Average: "+ (float)(total/5) );
}
catch(Exception
e) { }
}
}
Output:
Enter
Student Name:
Sateesh
Enter
Student Number:
47
Enter
Subject1 Marks:
100
Enter
Subject2 Marks:
100
Enter
Subject3 Marks:
100
Enter
Subject4 Marks:
100
Enter
Subject5 Marks:
99
student
Total Marks :499
Student
Aversge :99.0
No comments:
Post a Comment