Computer Science, asked by aking19, 5 months ago

the annual examination result of 10 students in a class are tabulated as follows:
roll no. sub a. sub b. sub. c
......... .......... ......... ...........
write a program to read the data calculated and display the following a) average mark obtained by each student b) print the roll no. and average marks of the student whose marks is above 80 c) print the roll number and average marks of students whose average marks is below 40 .
plzzzz do solve it. ​

Answers

Answered by Anonymous
3

Answer:

/*

* The annual examination results of 50 students in a class is tabulated as follows:

* Roll no. Subject A Subject B Subject C

* ...... ....... ....... .......

*

* Write a program to read the data, calculate & display the following:

* a) Average marks obtained by each student

* b) Print the roll no. & average marks of the students whose average mark is above 80

* c) Print the roll no & average marks of the students whose average marks is below 40

*/

import java.io.*;

public class questionNINE2009

{

public static void main(String args[]) throws IOException

{

BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

int roll[]=new int[50];

int marksA[]=new int[50];

int marksB[]=new int[50];

int marksC[]=new int[50];

float avg[]=new float[50];

int i,j;

for(i=1; i<=50; i++)

{

System.out.println("Enter roll number of the student");

roll[i]=Integer.parseInt(br.readLine());

System.out.println("Enter marks of the student in Subject A");

marksA[i]=Integer.parseInt(br.readLine());

System.out.println("Enter marks of the student in Subject B");

marksB[i]=Integer.parseInt(br.readLine());

System.out.println("Enter marks of the student in Subject C");

marksC[i]=Integer.parseInt(br.readLine());

avg[i]=(marksA[i]+marksB[i]+marksC[i])/3;

}

System.out.println("----------------------------------RESULT----------------------------------------------");

System.out.println("Roll no. \t Subject A \t Subject B \t Subject C \t Average ");

for(j=1; j<=50; j++)

{

System.out.println(roll[j] +"\t \t" + marksA[j] +"\t \t" + marksB[j] +"\t \t" + marksC[j] +"\t \t" + avg[j] );

}

System.out.println("\n roll no. & average marks of the students whose average mark is above 80");

System.out.println("Roll no. \t Average ");

for(j=1; j<=50; j++)

{

if(avg[j]>80)

System.out.println(roll[j] +"\t \t" + avg[j]);

else

System.out.println("N.A. \t \t N.A.");

}

System.out.println("\n roll no. & average marks of the students whose average mark is below 40 ");

System.out.println("Roll no. \t Average ");

for(j=1; j<=50; j++)

{

if(avg[j]<40)

System.out.println(roll[j] +"\t \t" + avg[j] );

else

System.out.println("N.A. \t \t N.A.");

}

}

}

Similar questions