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]
2 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:
Alex2 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
Sharon's company has written a new computer program, and she has been asked to find a way to prevent people from copying the sof
Tasya [4]

Answer:

Sharon's company has written a new computer program, and she has been asked to find a way to prevent people from copying the software they purchase and giving it to others who have not purchased the software. What can Sharon's company do to make sure a customer who p…

A:

Use DRM.

Explanation:

Use DRM.

8 0
2 years ago
4. Select the correct answer.
3241004551 [841]

Answer: B.  PDF

Explanation:

Portable Document Format (PDF) is such an important document that it is considered the international standard for information and document exchange. It is used for letters, resumes and even electronic contracts.

PDF was developed by Adobe to make it independent of the device or application it is being viewed on and combines layers of information into one layer thereby making it a flat document.

7 0
3 years ago
How do i unblock a website on a school computer if a school blocks it?
tresset_1 [31]

Answer:

look up ultrasurf and just follow the thingy and it will download a vpn ive had it on my computer for a fat min

Explanation:

4 0
2 years ago
. Which of the following is NOT a
joja [24]

Answer:

solution

Explanation:

The correct option is - solution

Reason -

To solve a problem,

Firstly we give input , then system will process that input which then gives output.

Solution is not a part of the process.

So, Solution is not a significant part of a simple problem.

7 0
2 years ago
8.3 code practice edhesive PLEASE HELP AND HURRY
NemiM [27]

Answer:

numbers = '14 36 31 -2 11 -6'

nums = numbers.split(' ')

for i in range(0, len(nums)):

  nums[i] = int(nums[i])

print(nums)

8 0
2 years ago
Other questions:
  • Problems with using a single Local Area Network (LAN) to interconnect devices on a premise include ______.
    12·1 answer
  • Wich of these is an example of magnetic storage
    11·1 answer
  • Java languageThe cost to ship a package is a flat fee of 75 cents plus 25 cents per pound.1. Declare a constant named CENTS_PER_
    5·2 answers
  • Questions 1 )When does a spring tide take place?
    14·2 answers
  • Interactive sites where users write about personal topic and comment to threaded discussion are called?
    10·2 answers
  • Please help me. Adnan also wants to add a photograph of a bridge. It is on another PowerPoint presentation that is open in a dif
    11·1 answer
  • Miley met up with a bunch of her college friends after several years. She told them that she works for the sound department of a
    5·1 answer
  • A company is developing a smart TV that connects to a wireless home network. Which technology can best help to establish this co
    11·2 answers
  • Help fast fast anyone
    10·1 answer
  • Can someone write this in java? Also, does anyone know how to do Edhesive assignments?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!