Search This Blog

Tuesday, December 14, 2010

Arrays based program - ICSE BOARD QUESTION 2009

/*
 * 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.");
        }
           
    }
}

8 comments:

  1. Full of errors don't know then why u r giving students may face problem������

    ReplyDelete
  2. oii what ever is ur name
    never upload wrong programs
    if we don't know anything we come to google, if the google is wrong what should we do

    ReplyDelete
  3. The ICSE board is one of the most popular boards in India and students who belong to the Icse board are very lucky. Because of the covid crisis, many students have been not concentrated on their studies, and Now they are worried about their exam then don't fear because Ziyyara is here for Helping You.
    Visit On:- icse online tuition
    Phone no - +91-9654271931

    ReplyDelete