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) {
		Program3.isDivisibleBy7(17);
		Program3.isDivisibleBy7(77);
		Program3.isDivisibleBy7(12);
	}
	
	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

 

Partners: casino ohne oasis paypal kasinot online casino ohne verifizierung paypal zimpler go casinon casinos ohne deutsche lizenz 10e talletus trustly esto nordea big bass bonanza pragmatic play casinos ohne 1000 euro limit bedste udenlandske online casino

Bushan Sirgur

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

Leave a Reply