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
Hey, wanna pair our account on Brainly so we can share the perks? https://brainly.com/invite/8db681239ab5027e03b097bcded13755?ut
sashaice [31]

Answer:

Explanation:

NO Thx

8 0
3 years ago
Read 2 more answers
A tool that is used to search for and gather data from a page on the internet is called a ?
pshichka [43]
It is called a sesrc engine
8 0
3 years ago
Read 2 more answers
What output is produced by
Natasha_Volkova [10]

Answer:

The answer to this question is given below in the explanation section. the correct option is C.

Explanation:

This is Java code statement:

System.out.print("Computing\nisInfun");

The output of this code statement is

Computing

isInfun

However, it is noted that the C option is not written correctly, but it is guessed that it will match to option C.

This Java code statement first prints "Computing" and then on the next line it will print "isInfun" because after the word "Computing" there is a line terminator i.e. \n. when \n will appear, the compiler prints the remaining text in the statement on the next line.

4 0
3 years ago
What tends to happen to the accuracy of our savings goals as our investment horizon becomes longer? A. It is not useful to have
liubo4ka [24]

Answer:

The answer is "Option B".

Explanation:

The Secured Goals are a part of your account, which is configured to just save your cash and also save it, and all the differences are good dividend savings accounts to shield this from accidental expenses. While opening the protected savings fund, the saving goal would be automatically created or loan rates invested only at the end of each month, that's why in this question "option B" is correct.

8 0
3 years ago
Which of these is the most likely result if the internet download speed in your home is 25 Mbps?
sashaice [31]

Answer:

Streaming movies may stop to buffer

Explanation:

microphones have a set record limit, and games downloaded wont generate errors unless something in the code is wrong, printers don't really need to connect to internet to work except for some, and streaming movies buffer because as you are watching them it downloads the next few minutes.

3 0
3 years ago
Other questions:
  • What is the height of the tallest possible red-black tree containing 31 values?
    7·1 answer
  • Write a Java application that inputs a series of 10 integers and determines and prints the largest and smallest integer. Use a c
    12·1 answer
  • Is it just me or is brainly not working right now? I am trying to add friends and it won't let me!
    5·2 answers
  • What would you use to compare two date ranges in a report?
    9·1 answer
  • Compose a program to examine the string "Hello, world!\n", and calculate the total decimal numeric value of all the characters i
    7·1 answer
  • Write a program that receives an character and displays its Unicode. Here is a sample run: Enter an character: E The Unicode for
    8·1 answer
  • Analyze the following code. Which of the following statements is correct?
    9·1 answer
  • 1. Trust can be built in a relationship if:
    15·1 answer
  • Cn someone help me plz
    11·1 answer
  • When must an Assured Equipment Grounding Conductor Program (AEGCP) be in place?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!