Thursday, 14 January 2021

program of class 11 for marks percentage of best 5 subjects

HAY THANK FOR VISIT



answer:-


import java.util.*;
class ICSE
{
    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);
        System.out.println("entre marks of english");
        int a=sc.nextInt();
        int sub[]=new int[6];
        int i,j,t=0,s=0;
        System.out.println("entre marks of science,maths.h.civics,c.a,geo,hindi");
        for(i=0;i<6;i++)
        {
            sub[i]=sc.nextInt();
        }
        for(i=0;i<5;i++)
        {
            for(j=0;j<6-i-1;j++)
            {
                if(sub[j]<sub[j+1])
                {
                    t=sub[j+1];
                    sub[j+1]=sub[j];
                    sub[j]=t;
                }
            }
        }
        System.out.print("percent marks=");
        for(i=0;i<5;i++)
        {
            s=s+sub[i];


        }
        s=s+a;
        System.out.println((double)s/6);
    }
}

No comments:

Post a Comment

HAY THAKYOU FOE VISIT

Program(python):-Find duplicates in an array (Geeks for geek problem)

QUESTION:- Given an array  a  of size  N  which contains elements from  0  to  N-1 , you need to find all the elements occurring more than o...