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
Finger [1]
1 year ago
14

Write a program in C++ to Find the Average of the sum of prime numbers between 1 to any given number

Computers and Technology
1 answer:
mixas84 [53]1 year ago
8 0

Using the knowledge in computational language in C++ it is possible to write a code that Find the Average of the sum of prime numbers between 1 to any given number

<h3>Writting in C++ code:</h3>

<em />

<em>#include <iostream></em>

<em>using namespace std;</em>

<em>bool isPrime(int n){</em>

<em>   for(int i = 2; i < n/2; i++){</em>

<em>      if(n%i == 0){</em>

<em>         return false;</em>

<em>      }</em>

<em>   }</em>

<em>   return true;</em>

<em>}</em>

<em>int findPrimeSum(int n){</em>

<em>   int sumVal = 0;</em>

<em>   for(float i = 2; i <= n; i++){</em>

<em>      if(isPrime(i))</em>

<em>         sumVal += i;</em>

<em>   }</em>

<em>   return sumVal;</em>

<em>}</em>

<em>int main(){</em>

<em>   int n = 15;</em>

<em>   cout<<"The sum of prime number between 1 to "<<n<<" is "<<findPrimeSum(n);</em>

<em>   return 0;</em>

<em>}</em>

See more about C++ code at brainly.com/question/19705654

#SPJ1

You might be interested in
Which of the following are examples of typical problems an ISS professional would encounter? Check all
natali 33 [55]
I’m guessing B! Seems to be the best
8 0
3 years ago
Read 2 more answers
I am currently building my own PC is there any part I should put first? Or is it just whatever?
Dominik [7]

Basically, I had the same question when I got my PC! You can do any part you choose as long as you put it together in the right place.

Hope this helped you!

4 0
3 years ago
Read 2 more answers
The process of __________ encourages members to accept responsibility for the outcomes of a group and for changing the style in
soldier1979 [14.2K]

Answer:

The correct answer to the following question will be Option B (Interpersonal feedback).

Explanation:

  • Interpersonal feedback seems to be a mechanism under which someone talks. Individuals deliver a message regarding their sensations and expectations of actions by another.
  • It encourages employees to take obligation for a group's results and to change the look they correspond to many other people in.

Therefore, Interpersonal feedback is the right answer.

8 0
3 years ago
How do technologies such as virtual machines and containers help improve
Alla [95]
The answer is.. D. By allowing multiple applications to run on a single server.

Got 100% on test!

Hope this helps!!
8 0
2 years ago
Write a brief explanation of the problems that can occur in each of the following scenarios and what you should do to avoid thes
photoshop1234 [79]
1. Horsing around can lead to breaking equipment in the classroom or somebody getting hurt

2. leaving your backpack on the floor can cause someone to fall

3.something unexpected may happen and worsen the problem

4. it can corrupt the computer's files and deleted unsaved work.

if you want the sentences to be longer, add some words to them and make the message the same.
4 0
4 years ago
Other questions:
  • Jessica has pinned her favorite applications as icons on her desktop. She always clicks on these icons to work on them. Which us
    5·1 answer
  • Why is the show "Insatiable so awesome?
    12·2 answers
  • When was kale discovered?
    9·1 answer
  • Wireless networks usually use ____ signals to send data.
    11·2 answers
  • g Write a recursive function all capital (L,start ,stop) that takes a string L and two integers. It returns a Boolean (True/Fals
    8·1 answer
  • What type of address uses a number that uniquely identifies each computer?
    6·2 answers
  • 5. The image file format most suited for photographs is what? *
    8·2 answers
  • What is computer? Write is features <br><br><br><br><br>​
    14·1 answer
  • 5) Match the following.
    12·1 answer
  • The short-range two-way communication technology behind contactless payments is called ____.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!