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
Kamila [148]
3 years ago
11

g Write a program that prompts the user to enter two integers. The program outputs how many numbers are multiples of 3 and how m

any numbers are multiples of 5 between the two integers (inclusive).
Computers and Technology
1 answer:
finlep [7]3 years ago
3 0

Answer:

number1=int(input("Enter first smallest integer number: "))#take the first integer from the user.

number2=int(input("Enter the second greatest integer number: "))#Take th esecond integer from the user.

if(number1>number2):#if condition

   print("The number is wrong, please try again")

else:

   multiple_of_3=0 #take a variable to count the multiple of 3.

   multiple_of_5=0 #take a variable to count the multiple of 5.

   while(number1<=number2):#while loop.

       if(number1%3==0):#if condition to count the multiple of 3.

           multiple_of_3=multiple_of_3+1#operation to count the multiple of 3.

       if(number1%5==0):#if condition to count the multiple of 3.

           multiple_of_5=multiple_of_5+1#operation to count the multiple of 3.

       number1=number1+1

   print("There are "+str(multiple_of_3)+" number are multiple of 3 and "+str(multiple_of_5)+" are multiple of 5")#print the count.

Output:

  • If the user gives the input 1 and 15, then it will print 5 for 3 multiple and 3 for 5 multiple.
  • If the user gives the input as 7 and 15, then it will print 3 for a multiple of 3 and 2 for a multiple of 5.

Explanation:

  • The above code is in python language, which is used to count the number of 3 multiple and 5 multiple.
  • There is a while loop that runs from the smallest number to greatest number and the check the number that it is a multiple of 5 and 3 or not by the help of if condition.
  • If it is multiple of 3, then multiple_of_3 variable is incremented by 1 and if it is a multiple of 5 then the multiple_of_5 is incremented by 1.
You might be interested in
Discuss why mtv initially had a difficulty securing enough ads
Alexxx [7]
MTV couldn't get enough ads because they didn't have enough distribution. MTV came up with the advertising campaign called “I want my MTV”. MTV executive named Les Garland got famous rock musicians to go on MTV, film a commercial spot and say, “I want my MTV”. And when these famous rockerstold the viewers to call their cable company and demand their MTV, the phones rang off the<span>hook.</span>
7 0
3 years ago
JAVA
shusha [124]

public class JavaApplication64 {

   

   public static void main(String[] args) {

       int count = 0;

       for (int i = 23; i <= 89; i++){

           if (count == 10){

               System.out.println("");

               count = 0;

           }

           System.out.print(i+" ");

           count += 1;

       }

   }

   

}

I hope this helps!

5 0
3 years ago
Implement a function called merge that does the following in C#:
levacccp [35]

Answer:

Check the explanation

Explanation:

using System;

using System.Collections.Generic;

using System.Linq;

public class Problem2

{

public static IEnumerable<int> merge (IEnumerable<int> input1, IEnumerable<int> input2, IEnumerable<int> input3)

{

IList<int> list = new List<int>();

foreach (int i in input1)

{

if(i%3==0 && ! list.Contains(i))

list.Add(i);

}

foreach (int i in input2)

{

if(i%3==0 && ! list.Contains(i))

list.Add(i);

}

foreach (int i in input3)

{

if(i%3==0 && ! list.Contains(i))

list.Add(i);

}

return list;

}

}

public class Problem2Demo{

static void Main (string[] args)

{

Random rnd = new Random ();

var list1 = Enumerable.Range (1, 10).Select (i => (rnd.Next () % 15) + 1);

var list2 = Enumerable.Range (1, 10).Select (i => (rnd.Next () % 15) + 1);

var list3 = Enumerable.Range (1, 10).Select (i => (rnd.Next () % 15) + 1);

var answer = Problem2.merge (list1, list2, list3);

foreach (int i in answer)

{

Console.WriteLine (i);

}

}

Kindly check the attached output image below.

8 0
3 years ago
[17 PTS] What do you think of puzzle games?
ira [324]

I love puzzle games, I like how they expand your knowledge and make you have to think.

3 0
3 years ago
PLEASE HELP!!!!!!!!!!
Shtirlitz [24]
<em>If i was answering this question I would pick D. Because a job is an organization of people working there and the people that work there have a strategic roll on the organization they work for because that's how they make their living!
</em>
7 0
3 years ago
Read 2 more answers
Other questions:
  • Jose calls you at the help desk because he is having a problem logging on to his laptop computer. After several unsuccessful att
    14·1 answer
  • What is the software called that allows the user to create, access, and manage a database? question 8 options:
    10·1 answer
  • You know a Linux command will perform a desired function for you, but you cannot remember the full name of the command. You do r
    14·1 answer
  • Suppose the information content of a packet is the bit pattern 1110 0110 1001 1101 and an even parity scheme is being used. What
    15·1 answer
  • People are able to predict future events to some extent because: (Select all that apply)
    11·1 answer
  • MULTIPLE CHOICE QUESTION PLEASE HELP!!!!!!!!!
    14·2 answers
  • . ------------ means that the two merging companiesbecame history and a new firm
    10·1 answer
  • What is a benefit of an account with interest?
    5·1 answer
  • Which of the following is NOT a function of a Web Browser?
    9·1 answer
  • Explain the measures put in place in order to maintain each of the element of computer security<br>​
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!