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
Of the people working in concert with security teams to ensure data quality and protection, the head of information management i
Svet_ta [14]

Answer:

true

Explanation:

because Internet

because Internet

3 0
2 years ago
Chemical equations of Carbon + water​
Setler79 [48]

Answer:

Aqueous carbon dioxide, CO2 (aq), reacts with water forming carbonic acid, H2CO3 (aq). Carbonic acid may loose protons to form bicarbonate, HCO3- , and carbonate, CO32-. In this case the proton is liberated to the water, decreasing pH. The complex chemical equilibria are described using two acid equilibrium equations.

PLS MARK AS BRAINLIEST

8 0
3 years ago
Many contemporary languages allow two kinds of comments: one in which delimiters are used on both ends (multiple-line comments),
m_a_m_a [10]

Answer and Explanation:

Multiple-line comments :

Advantage :In the event that we need to remark out of zone of the given program , we can utilize it.

Disadvantage : In numerous line results are in reduced unwavering quality. It stretches out the remark as far as possible of the following comment.For least difficult approach to unintentionally leave off the last delimiter, which successfully expelling code from the program.

Single Line Comments :

Advantage :In the event that you need to close all the delimiter before close the program we utilize this kind of remarks.

Disadvantage : It put more burden on your program .It repeated on every line of a block of comments

3 0
2 years ago
Consider the following statements: Statement A: In Duplex transmission, either node can transmit while the other node can receiv
sergij07 [2.7K]

Answer:

<u>d. Statement A is true and Statement B is false</u>

Explanation:

Indeed, when using duplex transmission either node can transmit while the other node can receive data from the network. Also, in half-duplex transmission, both the nodes can transmit as well as receive data.

However, in half-duplex transmission, the nodes <em>cannot </em>transmit and receive data at the same time. Hence, this makes Statement B false, while Statement A is true.

4 0
2 years ago
What is the name of the book farrah gray published in 2005??
seropon [69]
He wrote Reallionaire
8 0
3 years ago
Other questions:
  • 1. _______ is when two things happen at one time when using the Scratch program.
    6·1 answer
  • Instructions:Select the correct answer.
    15·2 answers
  • Create a view named ItemOrder view. It consists of the TaskID, description, price, order number, order date, and quoted price fo
    8·1 answer
  • 4. How can you select non-adjacent cells (i.e. cells that are not all together in one block)?
    5·2 answers
  • What is not a common purpose for a research report?
    5·2 answers
  • The limitation of trade secret protection for software is that it is difficult to prevent the ideas in the work from falling int
    9·1 answer
  • Which career involves analyzing various factors that influence the customer decision-making process?
    13·1 answer
  • Alex’s family members live in different parts of the world. They would like to discuss the wedding plans of one of their distant
    7·2 answers
  • I need help so bad it’s the entire test for EdHesive python coding Test 2
    5·1 answer
  • Write the line of Python code that calculates and prints the answer to the following arithmetic expressions.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!