Determine the following information about each value in a list of positive integers.
a. Is the value a multiple of 7, 11, or 13?
b. Is the sum of the digits odd or even?
c. Is the value a prime number?

You should write a function named test7_11_13 with an integer input parameter and three type int output parameters (aka pointers) that send back the answers to these three questions. If the integer is evenly divisible by 7, 11 or 13, its respective output parameter should be set to 1, otherwise zero. Some sample input data might be:

104 3773 13 121 77 30751

Respuesta :

Answer and Explanation:

Using Javascript:

test7_11_13(num){

If(num%7===0||num%11===0||num%13===0){

Console.log("yes it is a multiple of 7,11 or 13");

}

else{

Console.log("It is not a multiple of any of the numbers");

}

function(num){

var makeString= num.toString();

var splitString= makeString.split("");

var makeNumber= splitString.map(Number());

var New_number= makeNumber.reduce(function(a, b) {

return a+b};,0)

}

If(New_number%2===0){

Console.log("it's an even number");

}

else{

Console.log("it's an odd number")

}

If(num%2===0||num%3===0||num%5===0||num%7===0||num%11===0){

console.log("it's not a prime number");

}

else{

console.log("it's a prime number");

}

}

From the above we have used javascript if..else statements to test the conditions for each question and output the answer to the console using console.log(). In the last part for prime number, you could also choose to use else if statements(if,else if, else if) to test the value of the num parameter and output if it's a prime number.

ACCESS MORE