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
What are the four principal services provided by S/MIME?
konstantin123 [22]

Answer:

Explanation:

Secure/Multipurpose Internet Mail Extensions, is a technology that permits you to encrypt your emails. S/MIME is based on asymmetric cryptography to protect your emails from unauthorized access. It also allows you to digitally sign your emails to verify you as the legitimate sender of the message, making it an effective weapon against many phishing attacks.

The four principal services presented by S/mime includes ;

Authentication, Non-repudiation of origin utilizing digital signatures, Message Integrity and message Privacy.

3 0
3 years ago
Drag the tiles to the correct boxes to complete the pairs.
inessss [21]
<h2>Answer:</h2><h2>Releases a new video of its new high - tech manufacturing facility; To create a customer alert about a new program. </h2>

<h2>2)Hosts an online sweepstakes. .....;To increase brand loyalty </h2>

<h2>3)Gives bloggers.....:To give customers a peek into its operation.</h2>

<h2>4)Asks customers to determine their. .....;To allow customers to be part of the product development. </h2>

8 0
4 years ago
Asia pacific and Japanese sales team from cloud kicks have requested separate report folders for each region.The VP of sales nee
MaRussiya [10]

Answer:

B) Create all new regional folders and move the reports to the respective region folder with viewer access.

Explanation:

Below are the options

A) Create grouped folders, keeping the top region folder sharing settings and limiting the sharing settings for the grouped folders for each region.

B) Create all new regional folders and move the reports to the respective region folder with viewer access.

C) Create all new regional folders and move the reports to the respective region folder with subscribe access.

D) Create subfolders, keeping the top region folder sharing settings and limiting the sharing settings for the subfolders for each region

In order to required reports at one place and also wants to retain the visibility for each folder the consultant should suggest that all new regional folders should be created and afterwards it would be moved to their relevant region folders by involving the viewer access feature so that the VP should access it anytime

Hence, the correct option is B.

3 0
4 years ago
Who creates Virus ? virus is not made for what?
m_a_m_a [10]
Virus is created by some dishonest people.
Virus iis not made for open source software
6 0
3 years ago
Read 2 more answers
Ashley has many interests. She likes to read, listen to music, and play soccer with her friends. But her favorite thing to do is
attashe74 [19]

ashley has a lot of interests

7 0
3 years ago
Other questions:
  • 1.) You are a digital forensic examiner and have been asked to examine a hard drive for potential evidence. Give examples of how
    13·1 answer
  • Nina is trying to learn more about how computers work. She has repeatedly read that the motherboard is the "brain” of the comput
    9·2 answers
  • When i click a link the page doesn't pop up HELP THE TOMATO
    9·1 answer
  • Describe one type of technology that is useful in producing images from space.
    9·1 answer
  • Which of the following would not be considered a PC?
    13·2 answers
  • Complete the second clause of the following Prolog program for member/2 where member(X, Y) checks whether X is an element (a mem
    7·1 answer
  • What have very strong chemical bonds and cannot be reshaped when heated.​
    6·1 answer
  • marianne needs to create a version of her slide presentation that does not include all the slides and will be used for a particu
    9·1 answer
  • Directions: Give the shortcut key for the following commands: 1. Open 2. Save 3. New document 4. Copy 5. Undo 6. Redo 7. Paste 8
    5·1 answer
  • When heading styles have been applied to a document, the user has the option to navigate through the document using which tab on
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!