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
otez555 [7]
3 years ago
14

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 =

11, the result would be 2 + 4 + 5 + 6 + 8 + 10 = 35.
Computers and Technology
1 answer:
Alex3 years ago
4 0

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

You might be interested in
The city government of Los Angeles recently upgraded its information technology infrastructure​ and, for the first​ time, implem
Maru [420]

Answer:

The correct answer to the following question will be Option A (Open source software).

Explanation:

It's a type of software which is open to all we can download that software by the free of cost. Wamp, Apache server is one of the example of the open source software.

Any software accessible for alteration which is circulated because of its source code is known as Open source software. Open source permissions influence the way technology is used, researched, updated, and circulated by individuals. In fact, it give permission to code users for using this software for whatever use might desire.

Which ensures it includes a developer authorization to modify the script in any manner they want to:

  • Developers will patch glitches.
  • Change features.
  • Modify the app to suit their needs.

No other software available for the alteration is available in the option. So, the proper answer is Option A.

8 0
3 years ago
Most network behavior analysis system sensors can be deployed in __________ mode only, using the same connection methods as netw
soldier1979 [14.2K]
Most network behavior analysis system sensors can be deployed in passive mode only, using the same connection methods as network based idpss. Idps works as a network or host based systems. Most Nba sensors can be deployed in passive mode only too. The Nba examines the network traffic.
7 0
2 years ago
Clive wants to write a query that will display the names of the students who scored less than 10 in their final exams. Which num
Mice21 [21]
I'd go for <span>FLOOR(x)
</span>

The numerical function FLOOR(x) can be used to return the largest integer value that is less than or equal to the numerical expression provided. The numerical function CEILING (x) is the opposite of FLOOR(x) since it gives the smallest integer value that is greater or equal to the numerical expression.






6 0
3 years ago
Read 2 more answers
___________ is a task pane used to correct grammar errors; opens when you click the Spelling &amp; Grammar button in the Proofin
BaLLatris [955]

Answer:

Spelling Task Pane

Explanation:

According to my research on Microsoft Office Studio, I can say that based on the information provided within the question the feature being mentioned in the question is called the Spelling Task Pane. By selecting this pane word will offer various grammar and spelling assistance, such as correcting words and offering one or more suggestions.

I hope this answered your question. If you have any more questions feel free to ask away at Brainly.

7 0
3 years ago
Read 2 more answers
Do software engineers save millions of dollars in usa
SCORPION-xisa [38]
Yes. They make a lot of money. So eventually after saving your Money, you will make a least 1 million dollars or more.
4 0
2 years ago
Other questions:
  • Need help this will affect my final grade in technology and the dead line has passed!!!
    11·1 answer
  • Can someone tell me how to get all A's with no effort?
    5·1 answer
  • 15) the following statement describes government depository librearies , except:
    12·1 answer
  • Why does the job market change overtime
    9·1 answer
  • Columns are most useful for which tasks ?
    12·1 answer
  • What is the main difference between a search engine and a web browser?
    6·2 answers
  • Simplify 0.2×0.03055 to 3 decimal places​
    15·2 answers
  • What is the alogarithm for solving the perimeter of a triangle
    11·1 answer
  • Which memory will be suitable (a) to Run a software (b) to store a software permanently ?
    9·1 answer
  • How are mathematics and computer science similar? Discuss any connections between numbers, logic, and other elements.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!