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
AleksAgata [21]
3 years ago
6

Write an if-else statement for the following: If user_tickets is less than 5, assign 1 to num_tickets. Else, assign user_tickets

to num_tickets
Computers and Technology
1 answer:
Genrish500 [490]3 years ago
7 0

Solution :

function tickets(user_tickets){

var num_tickets;

if (user_tickets < 5) {

num_tickets = 1;

return ('num_tickets: '+ num_tickets);

}

else {

num_tickets = user_tickets;

 return('num_tickets: '+ num_tickets);

}

}

// Testing the tickets function

// With user_tickets = 3, 5, 8, and 1

console.log(tickets(3));

console.log(tickets(5));

console.log(tickets(8));

console.log(tickets(1));

You might be interested in
Write a program that takes an integer n as a parameter and sums all of the multiples of 2 or 5 from 1 to n. For example, if n =
Alex

Answer:

// here is code in c++.

#include <bits/stdc++.h>

using namespace std;

// main function

int main() {

// variable

int num;

int tot_sum=0;

cout<<"enter a number: ";

// read the value of n

cin>>num;

// check the multiple of 2 or 5 from 1 to n

for(int x=1;x<=num;x++)

{

// if multiple of 2 or 5 then add them

   if(x%2==0 ||x%5==0)

   {

       tot_sum=tot_sum+x;

   }

}

// print the sum

cout<<"sum of multiple of 2 or 5 is:"<<tot_sum<<endl;

return 0;

}

Explanation:

Read the number "n" from user.Check every number from 1 to n, if it is a multiple of 2 or 5 then add them to "tot_sum".When the for loop end, "tot_sum" will have sum of all the number which are either multiple of 2 or 5.Print the sum.

Output:

enter a number:11

sum of multiple of 2 or 5 is:35

4 0
2 years ago
How does a computer work
ivann1987 [24]

Answer:

computer works on electricity

Explanation:

6 0
2 years ago
What does cro stand for?
mr_godi [17]
It stands for Chief Risk Officer 
8 0
3 years ago
Read 2 more answers
Pleasee help meeeeeeeeee I’m stuckk!!!!
Anit [1.1K]

Answer: Charles Babbage

4 0
2 years ago
Read 2 more answers
The browser feature which enables tabs to work independently from one another so if one crashes, the others may continue to work
Mars2501 [29]

Answer:

Tab isolation

Explanation:

Tab isolation is a feature of the browser that works to protect your data from malware. its uses to enhance the reliability of the browser by considering the impact of the crash.

A browser without the tab isolation can be crash fully due to the crashing of one tab. this feature helps to recover the previous opening tab after crashing while on the previous version of the browser if one tab crashes then it automatically crashes all other tabs.

8 0
3 years ago
Other questions:
  • Assume that the classes listed in the Java Quick Reference have been imported where appropriate.
    14·1 answer
  • You want to display the process of raising a scholarship request and its approval on a slide. Which element in the presentation
    5·1 answer
  • The maximum number of colors that should be used on a slide is _____. 2 4 6 8
    5·1 answer
  • What is commodity? explain
    14·1 answer
  • Create a program to calculate the wage. Assume people are paid double time for hours over 60 a week. Therefore they get paid for
    10·1 answer
  • Jim is in the market for a car that will last for the next 10 years and has saved up some money for the purpose of a car. What’s
    8·2 answers
  • It is possible to limit the search results to a range of publication dates.
    13·1 answer
  • What is the definition of a flowchart? *
    13·1 answer
  • Which is the highest level of the hierarchy of needs model?
    14·1 answer
  • Write a program that takes in an integer in the range 10 to 100 as input. Your program should countdown from that number to 0, p
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!