Write a program called CheckPassFail which read the mark fro

Write a program called CheckPassFail which read the mark from user and prints \"PASS\" if the mark is more than or equal to 60; or prints \"FAIL\" otherwise.

Solution

package chegg;

import java.util.Scanner;

/*class CheckPassFail */
public class CheckPassFail {

   /*main method*/
   public static void main(String[] args) {
       Scanner sc=new Scanner(System.in);
       /*define integer variable marks */
       int marks ;
         
       System.out.println(\"Enter Marks :\");
      
       /*read marks from user*/
       marks= sc.nextInt();
      
       if(marks>=60)
   {
   /*if marks greater or equal then 60, then Print \"PASS\"*/
   System.out.println(\"PASS\");
   }
   else
   {
   /*if marks less then 60, then Print \"FAIL\"*/
       System.out.println(\"FAIL\");
   }
   }

}//end class

============================

output sample 1:

Enter Marks :
60
PASS

output sample 2:

Enter Marks :
59
FAIL

---------------------------------------------------------------------------------------------

If you have any query, please feel free to ask.

Thanks a lot.

 Write a program called CheckPassFail which read the mark from user and prints \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site