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
sweet-ann [11.9K]
3 years ago
7

Write a C++ program to find all numbersless than 1000 which are:

Computers and Technology
1 answer:
Elden [556K]3 years ago
8 0

Answer:

The c++ program is shown below.

#include <iostream>

using namespace std;

int main() {    

   cout<<"Numbers less than 1000 which are divisible by 7"<<endl;    

   for(int k=1; k<1000; k++)

   {

       // number should give remainder 0 which show complete divisibility

       if(k%7 == 0)

           cout<<k<<"\t";

   }    

   cout<<endl<<"Numbers less than 1000 which are divisible by 11"<<endl;    

   for(int k=1; k<1000; k++)

   {

       if(k%11 == 0)

           cout<<k<<"\t";

   }    

   cout<<endl<<"Numbers less than 1000 which are divisible by 7 but not divisible by 11"<<endl;    

   for(int k=1; k<1000; k++)

   {

       // for 11, number should not give remainder 0 which shows incomplete divisibility

       if(k%7 == 0 && k%11 != 0)

           cout<<k<<"\t";

   }    

   cout<<endl<<"Numbers less than 1000 which are divisible by 7 and divisible by 11"<<endl;

   

   for(int k=1; k<1000; k++)

   {

       if(k%7 == 0 && k%11 == 0)

           cout<<k<<"\t";

   }    

   cout<<endl<<"Numbers less than 1000 which are not divisible by 7 and not divisible by 11"<<endl;    

   for(int k=1; k<1000; k++)

   {

       if(k%7 != 0 && k%11 != 0)

           cout<<k<<"\t";

   }    

   return 0;

}

Explanation:

The test for divisibility is done by using the modulus operator which is used as a condition inside the if statement. This test is done inside for loop.

All the numbers from 1 to 999, less than 1000, are divided by 7 and/ or 11 depending on the sub question. Only the numbers which are completely divisible are displayed. Divisible numbers give remainder 0 always.

The divisibility test by 7 is shown below.

cout<<"Numbers less than 1000 divisible by 7"<<endl;    

   for(int k=1; k<1000; k++)

   {

       if(k%7 == 0)

           cout<<k<<"\t";

   }    

In other words, all the numbers divisible by 7 are same as the numbers in the table of 7.

The same logic shown above is applied for other sub questions to test for divisibility by 11 and combination of 7 and 11.

To improve readability, tabs and new lines are inserted at appropriate places.

You might be interested in
The technology that identifies people through bodily characteristics is known as
vlabodo [156]
C. Biometrics, examples of common biometric devices are finger print scanners (iphones, phones, laptops etc..) and pupil scanners.  
3 0
3 years ago
In a dark place you have only a match , a twig , campfire logs , and oil lamp and a candle which do you literally first /
ohaa [14]

Answer:

You would use a twig first :)

Explanation:

3 0
3 years ago
Which of the following best describes the protocols used on the Internet?
ASHA 777 [7]

Answer:

C: The protocols of the Internet are open and used by all devices connected to the network

Explanation:  Hope this helps.  

There are billions of devices connected to the Internet, and hundreds of different kinds of devices: laptops, tablets, phones, refrigerators, handheld credit card readers, and so on. Protocols (standards) ensure that the variety of devices interact with each other smoothly.  There are a lot of protocols! The Internet was designed with several layers of abstraction that sort the protocols according to what part of the process they support.

4 0
3 years ago
Complete the following statements by choosing the correct answer from the drop-down menus.
LUCKY_DIMON [66]

Answer:

1) control panel

2) WYSIWYG HTML

3) website directory

4)website directory

Explanation:

In the website host’s <u>control panel</u>, there is a set of tools for organizing the website.

A <u>WYSIWYG HTML</u> editor lets the website creator type directly into the web pages or specific fields without knowing HTML code.

All website files need to reside in the  <u>website directory.</u>

The <u>website directory</u> is where all of the content will be stored.

<u>OAmalOHopeO</u>

7 0
3 years ago
Write an input command using the variable company_name.
Oxana [17]

Answer:

company_name = input("What if your company name?");

print("I hope " + company_name + "becomes successful!");

Explanation:

The input of the user becomes a variable which is then stored in order to print it out as a message.

4 0
3 years ago
Other questions:
  • You have been hired to set up a network for XYZ Enterprises. What factors will you consider to determine the type of network nee
    7·2 answers
  • How many possible values will an eight bit audio sample have
    14·1 answer
  • does someone know how to change G,o,o,g,l,e and utube location or choose what ads I wanna see, the ads and info that pops out on
    6·1 answer
  • An operating system is an example of _______. The hard drive, keyboard and monitor are example of_______.​
    11·1 answer
  • The atomic number of oxygen is 8. the atomic mass of oxygen is 16. him many neutrons does oxygen have
    12·1 answer
  • What is a service-oriented architecture? Group of answer choices A business-driven enterprise architecture that supports integra
    13·1 answer
  • Computer input is the process of translating physical signals (light, sound, movement) into which of the following?
    8·2 answers
  • Which of the following lists contains the five essential elements of a computer? Group of answer choices: 1. inputs, returns, pr
    11·1 answer
  • How can I unblock Brainly?
    12·2 answers
  • ¿Cómo afecta negativamente a las relaciones familiares el uso de la tecnología?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!