write this java program
Attachments:
Answers
Answered by
1
import java.util*;
public class divisiblity
{
public static void main()
{
Scanner sc =new Scanner(System.in);
System.out.println("enter a no.");
int a =sc.nextInt();
if(a%3==0&&a%5!=0)
System.out.println("divisible by only 3");
else if(a%5==0&&a%3!=0)
System.out.println("divisible by only 5");
else if(a%5==0&&a%3==0)
System.out.println("divisible by both 3&5");
else
System.out.println("not divisible by anyone");
}
}
bhai pllllzzzzzz brain list answer
public class divisiblity
{
public static void main()
{
Scanner sc =new Scanner(System.in);
System.out.println("enter a no.");
int a =sc.nextInt();
if(a%3==0&&a%5!=0)
System.out.println("divisible by only 3");
else if(a%5==0&&a%3!=0)
System.out.println("divisible by only 5");
else if(a%5==0&&a%3==0)
System.out.println("divisible by both 3&5");
else
System.out.println("not divisible by anyone");
}
}
bhai pllllzzzzzz brain list answer
varun3632:
why not
Similar questions