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
______ is an example of unauthorized access to your computer or accounts.
pychu [463]
Well, it wouldn't be Adware because that just has to do with ads and stuff...
It wouldn't be cookies either because they just store things to make life easier.

It would be between Phishing and Hacking. I don't think it's Phishing because that's tricking someone into giving them your account information.

I think it would be hacking.

I hope that this helps. If it does, please rate it as Brainliest :D


4 0
3 years ago
Disconnecting or making the equipment safe involves the removal of all energy sources and is known as _____________. A) Isolatio
Ray Of Light [21]

Isolation. Also is known as Lockout-Tagout. I hope this helps.

5 0
3 years ago
Read 2 more answers
Flash drive / USB is ___________ device. A)Input B)Output C)Internal D)None of these
svetlana [45]

Explanation:

USB is a output devices

7 0
1 year ago
Whatis NOT a key factor while designing a website?
Vaselesa [24]

Answer: Complexity

Explanation: Web designing is referred as the designing of a web page for different purposes such as online business,etc. The most important factor is usability for the improvement in performance of any site and keeping it successful.

It should be user friendly so that interaction and understanding between user and web page can easy.Consistency is also a feature which ensure that web page opened in any browser should have similar quick working.

But there should be no complexity present in the web design which can cause misunderstand with the user and functioning.

7 0
2 years ago
Write any 2 differences between implicit variables and explicit variables.​Plz tell :' (
Marrrta [24]
Explicit is stated very clearly
Implicit is implied
Explicit leaves no room for confusion
Implicit doesn’t have to be directly stated
3 0
3 years ago
Other questions:
  • Define a function begins_with_line that consumes a string and returns a boolean indicating whether the string begins with a dash
    15·1 answer
  • Please help
    5·1 answer
  • Owning provides _________ flexibility but can lead to _________ costs in the long-term.
    7·2 answers
  • Most Internet users access commercial websites, which have higher-quality information because of higher editing standards and th
    12·1 answer
  • ........ is a formal description of message formats and the rules for exchanging those messages
    12·1 answer
  • Yall like portal 1 or 2
    8·1 answer
  • Kyle returns to work the next day and he would like to continue working on the document from yesterday. What should Kyle do?
    7·1 answer
  • Document accurately describes the differences between servers and computers and between local and wide area networks. Document p
    5·1 answer
  • Which of the following statement is correct ? A . potential difference is measured by ammeter . B . The unit of potential differ
    9·1 answer
  • Collaboration, listening, and negotiating are considered __________ skills.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!