Posted by : Unknown
Sunday, 28 June 2015
Syntax:
if(condition)
statement;
statement;
Program:
import java.util.Scanner;
class result
{
public static void main(String[] args)
{
int mark;
Scanner s=new Scanner(System.in);
System.out.print("Enter your mark: ");
mark=s.nextInt();
if ( mark >= 40 )
{
System.out.println("Pass");
}
}
class result
{
public static void main(String[] args)
{
int mark;
Scanner s=new Scanner(System.in);
System.out.print("Enter your mark: ");
mark=s.nextInt();
if ( mark >= 40 )
{
System.out.println("Pass");
}
}
}
Output:
Enter your mark: 44
Pass