Student mark list
import java.io.*;
class stud
{
public static void main(String a[])
{
String nam,dep;
int m[]=new int[5];
int tot,avg,r,i;
try
{
int s[]=new int[20];
InputStreamReader ii;
BufferedReader br;
ii=new InputStreamReader(System.in);
br=new BufferedReader(ii);
System.out.println("Enter your name");
nam=br.readLine();
System.out.println("Enter the department name");
dep=br.readLine();
System.out.println("Enter the 3marks");
for(i=1;i < =3;i++) { m[i]=Integer.parseInt(br.readLine()); } tot=0; int t=0; for(i=1;i < =3;i++) { tot +=m[i]; if(m[i]>50)
t=1;
}
avg=tot/3;
System.out.println("Name="+nam);
System.out.println("Department="+dep);
for(i=1;i < =3;i++) System.out.println("M"+i+"="+m[i]); System.out.println("Total="+tot); System.out.println("Average="+avg); if (t==1) System.out.println("Result=Pass"); else System.out.println("Result=Fail"); } catch(IOException as) {} }} Output: Z:\java>java stud
Enter your name
Lakshmi
Enter the department name
MCA
Enter the 3marks
87
68
98
Name=Lakshmi
Department= MCA
M1=87
M2=68
M3=98
Total=253
Average=84
Result=Pass