write a Java program to check whether the entered number is divisible by 5 or not
Answers
Answered by
8
public class Divisible
{
public void main ( int n)
{
if(n%5==0)
System. out.print(n+ "is divisible by 5");
else
System.out.print(n+ "is not divisible by 5");
}
}
{
public void main ( int n)
{
if(n%5==0)
System. out.print(n+ "is divisible by 5");
else
System.out.print(n+ "is not divisible by 5");
}
}
ruchi396:
thank you
Answered by
6
Heya user
Here is your answer !!
____________
import java.util.*;
public class Divisibility
{
public static void main ( String args [] )
{
Scanner in = new Scanner ( System.in ) ;
System.out.print ( " Enter a number : " ) ;
int n = in.nextInt() ;
if ( n % 5 == 0 )
System.out.println ( n + " is divisible by 5 " ) ;
else
System.out.println ( n + " is not divisible by 5 " ) ;
}
}
____________
Hope it helps !!
Here is your answer !!
____________
import java.util.*;
public class Divisibility
{
public static void main ( String args [] )
{
Scanner in = new Scanner ( System.in ) ;
System.out.print ( " Enter a number : " ) ;
int n = in.nextInt() ;
if ( n % 5 == 0 )
System.out.println ( n + " is divisible by 5 " ) ;
else
System.out.println ( n + " is not divisible by 5 " ) ;
}
}
____________
Hope it helps !!
Similar questions