WAP to check whether a number is divisible by 7 or not using scanner.
3 years ago
OOP Java
Compile code:
import java.util.Scanner;
public class Divisible_by_7ornot{
public static void main(String[]args)
{
int n;
Scanner s = new Scanner(System.in);
System. out. print("Enter any number:");
n = s. nextInt();
if(n % 7 == 0)
System. out. println(n+" is divisible by 7");
else
System. out. println(n+" is not divisible by 7");
}
}
Output:

Dipti KC
Jan 8, 2023