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
Analyze the problem statement. Select the correct answer. Vision: We want to decrease errors in our billings to clients. Issue:
finlep [7]

Answer: This problem statement does not provide a useful issue statement.

3 0
3 years ago
HELP!!!
aleksley [76]

Answer:

The detail answer of this question is given in explanation section.

The simple answer is option B

Explanation:

Let took at each option:

A) an html tag

An html tag is used to start and end html document. It does not have anything to do with rendering.

B) a doctype declaration

The document type declaration is necessary because it tell the browser which version of html should be rendered.

C)Body tag tell the browser. it is the visible area of website.

D) A hear tag is used to clear meta data about website.

3 0
2 years ago
Read 2 more answers
Focusing on the general characteristics of a problem or object, while ignoring the details, is a technique called
Taya2010 [7]

Answer:

Abstraction

Explanation:

In computer science, abstraction has a similar definition. It is a simplified version of something technical, such as a function or an object in a program. The goal of "abstracting" data is to reduce complexity by removing unnecessary information. At some level, we all think of computers in abstract terms.

5 0
2 years ago
____ map a set of alphanumeric characters and special symbols to a sequence of numeric values that a computer can process.
Neporo4naja [7]
The answer is : coding schemes
4 0
3 years ago
All slides in a presentation must use the same transition. True or False?
krek1111 [17]
False. you can make different slides have different transitions
7 0
3 years ago
Read 2 more answers
Other questions:
  • Discuss why mtv initially had a difficulty securing enough ads
    10·1 answer
  • Write a program that takes the radius of a sphere (a floating-point number) as input and then outputs the sphere’s: Diameter (2
    7·1 answer
  • Your computer has a single hard disk w/ a single volume used by the C:\ drive. You have previously upgraded the disk to a dynami
    6·1 answer
  • Which of the following are characteristics of algorithms? Choose all that apply. They take a step-by-step approach to performing
    12·1 answer
  • . Write a toString method for this class. The method should return a string containing the base, height and area of the triangle
    10·1 answer
  • Identify and discuss the seven layers of the Open System Interconnection (OSI) model and their importance on TCP/IP operation.
    7·1 answer
  • Java code?????
    12·1 answer
  • Which statement describes what the Conditional Formatting option in Excel 2016 allows users to do?
    15·2 answers
  • What is meant by reflection?​
    9·2 answers
  • Help? Can you explain what this mean?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!