Computer Science, asked by pandeyaparna, 1 year ago

program in java:
The marks obtained by a student in 5 subject are input . the student gets a division as per the following rules-
percentage above or equal to 60-first division
percentage above or equal to 50-second division
percentage above or equal to 40-third division
otherwise fail ......... do with else if ladder.

Answers

Answered by siddhartharao77
1
import java.util.Scanner;

public class Exam
{   
 public static void main(String args[]) 
   {       
 int mark[] = new int[5];

     int i;

        float sum=0, avg;

        Scanner scan = new Scanner(System.in);

        System.out.print("Enter Marks Obtained in 5 Subjects : ");

        for(i=0; i<5; i++)     
  {           
 mark[i] = scan.nextInt();

            sum = sum + mark[i];   
     }

        avg = sum/5;

        if(avg>=60)   
    {       
    System.out.print("I division"); 
      }       
 else if(avg>=50)   
    {         
  System.out.print("II division"); 
       }       
 else if(avg>=40)     
   {       
    System.out.print("III division");     
  }   
     else   
    {       
    System.out.print("Legends born with success: ");   
     } 
  }
}


Hope this helps!
Similar questions