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]
11 months 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]11 months 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
What type of internet connection do you think you'd get in Antarctica?
rusak2 [61]
Hello!
My best guess is you would have to use mediocre satellites that float over for internet connection.
3 0
3 years ago
Read 2 more answers
What is the worst case running time of a linear search?
shtirl [24]

Answer:

The worst case running time of a linear search is O(N).

Explanation:

In a linear search, you will run the program looking at each array position until you find your desired information.

The best case scenario is when you find it at the first position.

The worst case scenario is when you find the value at the last array position. So, in a N-length array, the information is at position N. This means that the worst case running time of a linear search is O(N).

3 0
3 years ago
Read 2 more answers
A colleague is complaining about the slowness of a desktop computer, and you explain that the slowness is
mr_godi [17]

Answer:

You are explaining a virtual server

I hope this is correct.

Explanation:

A virtual platform is a software based system that can fully mirror the functionality of the platform, it provides full visibility

A virtual server, on the other hand converts one physical server into multiple virtual machines that can each run their own operating system, it is hosted by a offsite dsta center

6 0
2 years ago
Back in the mid-1800s, who was one of the first artists to retouch negatives to reduce or eliminate any imperfections in the sho
tia_tia [17]

Answer:

Calvert Richard Jones

Explanation:

Just five years later, in 1846, the first known act of photographic retouching was performed by a Welsh colleague of Talbot's named Calvert Richard Jones, or perhaps by one of Jones's associates

6 0
2 years ago
Read 2 more answers
After an extruded feature has been created, you can always go back and edit the feature. When you edit an existing extrude featu
Pani-rosa [81]

Answer:

After an extruded feature has been created, you can always go back and edit the feature. When you edit an existing extrude feature, <u>the shape of the sketch profile</u> cannot be changed from the Extrude Property Manager.

<u>Extrude PropertyManager</u>

A tool that is used to draw different sketch. The sketches are related to different fields. Extrude property manager is used to edit the sketch, delete some objects form the sketch but we cannot edit the shape of the sketch profile.

<em>In this tool we can edit every thing but cannot edit the shape of the sketch profile.</em>

3 0
3 years ago
Other questions:
  • A student is reading a book for language arts. She has to finish three chapters by class tomorrow, because there will be a quiz.
    6·2 answers
  • What technique is used to separate the different cell parts?
    15·1 answer
  • Whenever Jim starts his laptop, he sees some commands and numbers appearing on his screen. These instructions are being processe
    12·2 answers
  • When he takes a picture, Simon freezes an action without blurring it, to show movement. Which type of photographer is he?
    9·2 answers
  • Robert is leading a project online that includes students from different cultures. Two of the students spend most of the time li
    7·1 answer
  • Name the two types of control systems.<br> PLEASE HELP THIS WAS DUE HOURS AGOOOO
    8·2 answers
  • ____ the styles allows the designer to start from a known baseline, confident that no unwanted styles will creep in from any bro
    6·1 answer
  • Multiple arrays. Jump to level 1 For any element in keysList with a value greater than 40, print the corresponding value in item
    7·2 answers
  • You are assigned by your teacher to perform the assembly of all the parts of the computer in preparation for the hands on activi
    7·1 answer
  • In this paper https://arxiv.org/pdf/2008.10150.pdf, I'm having a hard time understanding how the assignment in the picture is de
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!