Computer Science, asked by nanditarumpi0078, 9 months ago

write a program to accept a number and divide it by 5. check it remainder is positive or zero .print likewise

Answers

Answered by kushal454100
1

Answer:import java.util.*;

class divideby5

{

public static void main (String x[])

{

Scanner sc=new Scanner(System.in);

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

int n=sc.nextInt();

double k=n%5;

if(k==0)

{

System.out.println("the entered number is divisible by  5 and the remainder is 0");

}

else

System.out.println("the entered number is not divisible by 5");

}

}

Explanation:

output

enter a number

5

the entered number is divisible by  5 and the remainder is 0

Similar questions