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
jeka94
4 years ago
8

Write a program that has a while loop to print out the first five multiples of 15, 43, and 273 between the numbers of 3168 and 3

76020. Put each of the three sets of multiples on a new line.
Computers and Technology
1 answer:
Reika [66]4 years ago
7 0

Answer:

#include <iostream>

using namespace std;

void printmultiples(int n) //function to print first five multiples between 3168 and 376020

{

   int a =3168,c=1;

   cout<<"First five multiples of "<<n<<" are : ";

   while(a%n!=0 && a<=376020) //finding first mutiple of n after 3168.

   {

       a++;

   }

   while(c<6)//printing multiples.

   {

       cout<<a<<" ";

       a+=n;

       c++;

   }

   cout<<endl;

}

int main() {

   int t,n;

   cin>>t;//How many times you want to check.

   while(t--)

   {

       cin>>n;

       printmultiples(n);//function call..

   }

return 0;

}

Input:-

3

15

43

273

Output:-

First five multiples of 15 are : 3180 3195 3210 3225 3240  

First five multiples of 43 are : 3182 3225 3268 3311 3354  

First five multiples of 273 are : 3276 3549 3822 4095 4368

Explanation:

I have used a function to find the first five multiples of the of the numbers.The program can find the first five multiples of any integer between 3168 and 376020.In the function I have used while loop.First while loop is to find the first multiple of the integer n passed as an argument in the function.Then the next loop prints the first five multiples by just adding n to the first multiple.

In the main function t is for the number of times you want to print the multiples.In our case it is 3 Then input the integers whose multiples you want to find.

You might be interested in
You have decided to use relative links for your Website's local pages instead of specifying absolute URLs. Your supervisor has a
marin [14]

Answer:

C. The site can be moved from one server to another with minimal disruption.

Explanation:

The perfect reason is the option C.The site can be moved from one server to another with minimal disruption. with relative links you don't need to change the host name for the local page because the browser assumes the address that is in the browser and creates a path relative to it as specified by the file.

4 0
3 years ago
The largest type of computer system with the most extensive storage capacity and the fastest processing speeds is a ________.
azamat
Super Computer. Hope I helped.
5 0
3 years ago
Letter Frequency Write a function that will take a string and return a count of each letter in the string. For example, "my dog
Nostrana [21]

Answer:

Check the explanation

Explanation:

Code to copy:

// ConsoleApplication7.cpp : Defines the entry point for the console application.

//

#include "stdafx.h"

#include <iostream>

#include <cstring>

#include <string>

using namespace std;

int * letterFrequency(char s[]);

int main()

{

  int *freq_letters;

  char *s = new char[100];

  freq_letters = new int[26];

  //To read the input string in order to find the frequency of each letter

  cout << "Enter a string: ";

  cin.getline(s, ' ');

  //call the function to find the occurrence of each alphabet

  freq_letters = letterFrequency(s);

  //Display the count

  cout << "Letter Frequency " << endl;

  for (int i = 0; i < 26; i++)

  {

      //Constriant to check if the letter appeared at least once in the string and so printing the frequency of its occurence

      if (freq_letters[i] != 0)

      cout << " " << static_cast<char>(i + 'a') << " " << freq_letters[i] << endl;

  }

  system("pause");

  return 0;

}

//Define the function to find occurrence of each letter in the input string

int * letterFrequency(char s[])

{

  int *occurrence_array;

//to store the output of occurrences for each alphabet

  occurrence_array = new int[26];

// to store the count of occurrence for each letter temporarily

  int letter_count;

  // for loop to check the occurrence for all 26 alphabets

 

  for (int i = 0; i < 26; i++)

  {

      letter_count = 0;

      for (int j = 0; j < strlen(s); j++)

      {

          /*comparing the ascii values of each alphabet with every character from the string by converting it to lower case i.e. case insensitive*/

          if (int('a') + i == int(tolower(s[j])))

              letter_count++;

      }

      occurrence_array[i] = letter_count;//To store the count calculated for each alphabet

  }

  return occurrence_array;

}

The following below code screenshot and output shows that when the string is entered, the output will shows each lettercount irrespective of whether the letter is in capitals or small and does not count non-letter characters (i.e spaces, punctuations etc.)

6 0
4 years ago
A desktop computer is a type of mobile device.<br><br> a. true<br> b. false
Charra [1.4K]
Answer:B.false
Answer B
4 0
3 years ago
Where does cable termination occur in most buildings?
Komok [63]

Answer:

Demarcation Point

Explanation:

The entrance point that can  be a device for the telecommunication utilities or service providers in the building. From this device or point users of the building takes the connection to their house or building. This point is also known as the termination point of the service to the building. The purpose of the this point is to provide ease in providing their services to the users of the building. The service provider is responsible for the maintenance till this point. After this point the user is responsible for the maintenance of the cable.

5 0
3 years ago
Other questions:
  • Refer to the exhibit. what is the administrative distance value of the route for router r1 to reach the destination ipv6 address
    9·1 answer
  •                                                        HELP PLEASE 
    12·2 answers
  • What is the process of copying items from ram to a storage device?
    8·1 answer
  • The chip that controls the radio frequency waves within a device
    9·1 answer
  • Characteristics of successful entrepreneurs include
    11·1 answer
  • Implement the function fileSum. fileSum is passed in a name of a file. This function should open the file, sum all of the intege
    11·1 answer
  • if you love games played on facebook, such as farmville, what might be your motivation for playing games
    13·1 answer
  • Imagine that you are preparing a multimedia presentation. What are the four things you need to consider when getting started?
    14·2 answers
  • How bridges are built over water
    14·1 answer
  • Networks that are designed to connect similar computers that share data and software with each other are called:_______
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!