Jump to content

User:KnowJava

From Wikipedia, the free encyclopedia

import java.util.Scanner; class array {

   void display()
   {
       Scanner sc=new Scanner(System.in);
       int n,a[]=new int[10],c=0,count=0;
       char letter='A';
       System.out.println("Enter 10 numbers");
       for(int j=0;j<=9;j++)
       {
           n=sc.nextInt();
           while (n>50)
           {
               System.out.println("INPUT MARKS WITHIN 50");
               System.out.println("INPUT AGAIN (Replace "+n+" with a valid number)");
               n=sc.nextInt();
           }
           a[j]=n;
       }
       for(int i=0;i<=9;i++)
       {
           System.out.println("Marks of "+letter+"="+a[i]);
           if(a[i]<25)
           {
               System.out.println(letter+" FAILED in the subject");
               System.out.println();
           }
           count++;
           if(count==1)
           {
             c=a[i];  
           }
           if(a[i]>c)
           {
               c=a[i];
           }
           letter++;
       }
       System.out.println("Greatest marks= "+c);
       for(int k=0;k<=9;k++)
       {
           
       }
   }

}