write a Java Program that will accept the score of a batsman and display whether the batsman has scored a century or not
Answers
Answered by
16
public class Century
{
public void main (int score)
{
if(score>=100)
System. out.println( "Batsman has scored century");
else
System. out.println("Batsman has not scored century");
}
}
{
public void main (int score)
{
if(score>=100)
System. out.println( "Batsman has scored century");
else
System. out.println("Batsman has not scored century");
}
}
ruchi396:
thank you very much
Answered by
15
Heya user
Here is your answer !!
_____________
import java.util.* ;
public class Century
{
public static void main ( String args [] )
{
Scanner in = new Scanner ( System.in ) ;
System.out.print ( " Enter the run scored " ) ;
int r = in.nextInt() ;
if ( r >= 100 )
System.out.println ( " The batsman has scored a century " ) ;
else
System.out.println ( " The batsman has not scored a century " ) ;
}
}
_____________
Hope it helps !!
Here is your answer !!
_____________
import java.util.* ;
public class Century
{
public static void main ( String args [] )
{
Scanner in = new Scanner ( System.in ) ;
System.out.print ( " Enter the run scored " ) ;
int r = in.nextInt() ;
if ( r >= 100 )
System.out.println ( " The batsman has scored a century " ) ;
else
System.out.println ( " The batsman has not scored a century " ) ;
}
}
_____________
Hope it helps !!
Similar questions
Physics,
7 months ago
Social Sciences,
7 months ago
Biology,
1 year ago
English,
1 year ago
Geography,
1 year ago