Thursday 26 March 2020

STUDENT MARKING PROCESS USING JAVA LANGUAGE

Q-27-Write a java program to input the mark of a student and check if the student mark is greater than or equal to 40, then it generates the following message.  “Congratulation! You have passed the exam.”  Otherwise the output message is  “Sorry! You have failed the exam.”

INPUT :
import java.util.Scanner;
public class NCM {

public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
int mark;
System.out.println("Enter The Mark You Have Secured :");
mark=sc.nextInt();
if(mark>=40 )
{
 if(mark<=100)
 {
  System.out.println("Congratulation ! You Have Passed The Exam.");
 }
 else
 {
  System.out.println("Oops! You Have Entered Wrong Input....");
 }
}
else
{
System.out.println("Sorry! You Have Failed The Exam.");
}
}


}

OUTPUT :
Enter The Mark You Have Secured :
39

Sorry! You Have Failed The Exam.

Enter The Mark You Have Secured :
73
Congratulation ! You Have Passed The Exam.

No comments:

Post a Comment