1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
S_A_V [24]
3 years ago
14

Determine the following information about each value in a list of positive integers.

Computers and Technology
1 answer:
german3 years ago
8 0

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.

You might be interested in
You are a desktop administrator for nutex corporation. Your organization uses ethernet cable to connect network resources. A use
anygoal [31]

Answer:

A. replace the network cable

Explanation:

Based on the information provided within the question it can be said that in this scenario the best option would be to replace the network cable. The network cable refers to the Ethernet cable that is connected to the individuals personal computer. This cable being faulty is most likely the reason as too why the individual is not able to connect. Since it is displaying that signals return too early it means that there is most likely information being lost in transit.

4 0
3 years ago
Plz plz plz plz plz plz plz plz plz plz plz pl plz plz plz plz plz plz plz plz plz plz plz plz olz plz plz
zvonat [6]

REM PROGRAM TO DISPLAY AVERAGE OF TWO NUMBERS

CLS

INPUT “ENTER FIRST NUMBER”; A

INPUT “ENTER SECOND NUMBER”; B

INPUT “ENTER THIRD NUMBER”; C

AV = (A + B + C) / 3

PRINT “AVERAGE OF THREE NUMBERS”; AV

END

hope this helpz

6 0
3 years ago
Need help developing code!!
Alexxandr [17]
If you are just starting go on khan academy and go to the computing section and they will start you out on the basics on code devoloping. 
4 0
3 years ago
Create a class called Book with the following properties using appropriate data types: Title, Author, numberOfPages, Create a se
tamaranim1 [39]

Answer:

I don't know the answer sorry

7 0
3 years ago
Write a program that simulates a lottery. The program should havean array of five integers named lottery, and shouldgenerate a r
Fiesta28 [93]

Answer:

Here is the C++ program that simulates lottery:

#include<iostream>  //to use input output functions

using namespace std;  //to access objects cin cout

int main(){  //start of main function

int size= 5; // size of arrays

int range = 10;  //range of random numbers from 0 to 9

int user[size];  // user array

int lottery[size];  // lottery array

for(int i=0;i<size;i++)  //iterates through the array

lottery[i]=rand()%range;  // generates random number in specified range

cout<<"Enter "<<size<<" digits: ";  //prompts user to enter 5 digits

for(int i=0;i<size;i++)  //loops through the user array

cin>>user[i];  //reads input digits from user

int match=0;  //stores number of matching digits

for(int i=0;i<size;i++)  //iterates through array to compare user and lottery arrays

if(user[i]==lottery[i])  //if digit at i-th index of user array matches to that of lottery array

match++;  //increments count of matching digits by 1

cout<<"Lottery array: ";  // display digits of lottery array

for(int i=0;i<size;i++)  //iterates through elements of lottery array

cout<<lottery[i]<<" ";  //prints elements of lottery array with a space between them

cout<<endl;  //prints a new line

cout<<"  User  array: ";  // prints digits of user array

for(int i=0;i<size;i++) //iterates through elements of user array

cout<<user[i]<<" ";  //prints elements of user array

cout<<endl;  // prints a new line

if(match==size){  //if all the digits match

cout<<"Congratulations. You are a grand prize winner! "; }//displays this message proclaiming the user as a grand prize winner

else{  // if all digits of user array do not match with lottery array digits

cout<<"Number of digits matched: "<<match<<endl; //displays the number of matched digits

cout<<"Sorry! Better luck next time!" ;    //displays this message when all digits don't match

}

}    

Explanation:

If you want to keep the size and range fixed then you can use #define before the main() function to give a constant value to size and range as:

#define size 5

#define range 10

The program uses rand() function in order to generate random numbers for lottery array in the range of 0 through 9.

Then the program declares a user array with size = 5 and prompts user to enter 5 digits to stores in user array.

Next the program matches each digit of user array to the corresponding digit of lottery array and if the two digits match then the program increments the match variable by 1 to count the matched digits. For example, lets say lottery has the following elements:

lottery: 7,4,9,1,3

Lets say user array has following elements input by user at console

user: 4,2,9,7,3

Now at first iteration the digit 7 at 0-th index of lottery array is matched to the digit 4 at 0-th index of user array. This index is specified using variable i. These means the first element of lottery array is matched with first element of user array. As these digits are not equal so they don't match and the variable i is incremented to point to the position of next digit.

Now at second iteration the digit 4 in lottery array is matched to the digit 2 of user array. As these digits are not equal so they don't match and the variable i is incremented.

at third iteration the digit 9 in lottery array is matched to the digit 9 of user array. As these digits equal so they match and the variable match is incremented to 1 in order to count the number of matches. So value of match = 1

Now at fourth iteration the digit 1 in lottery array is matched to the digit 7 of user array. As these digits are not equal so they don't match and the variable i is incremented. The value of match also remains the same i.e. 1

at fifth iteration the digit 3 in lottery array is matched to the digit 3 of user array. As these digits equal so they match and the variable match is incremented to 1 in order to count the number of matches. So value of match = 2

Next the loop ends because the value of exceeds 5 which is the size of the array.

Next if(match==size) statement has an if condition which checks if all digits match. This is checked by comparing the count of match variable to the size of the array. The value of match is 2 and value of size is 5 so this means that all the digits do not match. Hence this condition evaluates to false. So the statement in if part will not execute and program moves to the statement: cout<<"Number of digits matched: "<<match<<endl; which displays the value of match variable i.e. 2 as:

Number of digits matched: 2

followed by statement cout<<"Sorry! Better luck next time!" ;  which displays the message:

Sorry! Better luck next time!

5 0
2 years ago
Other questions:
  • To include totals and other statistics at the bottom of a datasheet, click the ____ button on the HOME tab to include the Total
    12·1 answer
  • Fair use allows individuals to break copyright so long as they ________.
    15·1 answer
  • A function may return a pointer, but the programmer must ensure that the pointer:
    14·1 answer
  • Suppose the file is sent continuously as one big message. how long does it take to send the file, assuming it is sent continuous
    15·1 answer
  • A _____ are devices that permit a user to connect to a digital t-carrier service.
    6·1 answer
  • What is the practical application of the information acquired by science.
    15·1 answer
  • Write any two merits and demerits of computer​
    8·1 answer
  • H e l p ASAP plz <br> and thanks
    9·1 answer
  • Why is making a model, or prototype, important in the design process?
    6·1 answer
  • What is the value of x after running this code?
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!