Computer Science, asked by avanger10, 1 year ago

input a number in java and check if it is divisible by 5 and 7 or 2 by the If Else process

Answers

Answered by lyric
1

import java.util.Scanner

public class Number

{

void main()

{

Scanner sc=new.Scanner(System.in);

System.out.println("enter a number");

int a=sc.nextInt();

if (a%5==0)

System.out.println("divisible by 5");

else if (a%7==0)

System.out.println("divisible by 7");

else if (a%2==0)

System.out.println("divisible by 2");

}

}


Similar questions