Test whether the number is divisible by 7 or not

Test cases:

Test cases Expected Result
isDivisibleBy7(17) false OK
isDivisibleBy7(77) true OK
isDivisibleBy7(12) false OK

Java solution:

public class Program3 {
	public static void main(String[] args) {
	public static boolean isDivisibleBy7(int num){
		if (num % 7 == 0) {
			return true;
		return false;

Javascript solution:

const isDivisibleBy7 = (num) => {
    if (num % 7 === 0) {
        return true;
    return false;

console.log(isDivisibleBy7(17)); //false
console.log(isDivisibleBy7(77)); //true
console.log(isDivisibleBy7(12)); //false


About the author

Bushan Sirgur

Hey guys, I am Bushan Sirgur from Banglore, India. Currently, I am working as an Associate project in an IT company.

View all posts

Leave a Reply

Your email address will not be published. Required fields are marked *