Help me plz

Dear Sir,
My question is that how i can write a c++ program that calculates and displays the sum of all prime numbers in a user-defined closed interval[a,b] of positive integers using both pre-defined (standard)and user-defined functions.

Waiting for your reply.

Thanking you,
Md.Zulfiker HOSSAIN
soton1985@hotmail.com

Comments

  • : Dear Sir,
    : My question is that how i can write a c++ program that calculates and displays the sum of all prime numbers in a user-defined closed interval[a,b] of positive integers using both pre-defined (standard)and user-defined functions.
    :
    : Waiting for your reply.
    :
    : Thanking you,
    : Md.Zulfiker HOSSAIN
    : soton1985@hotmail.com
    :
    :
    I am not to advanced in c++ but this may be a solution without stdandard funtions

    you get the inteval with two input statements cin << a and cin << b

    then run a function that would get all of the prime numbers <= b that number, and read them into a vector

    then run the same function for prime numbers <= a and read them into a different vector

    then erase all of the same prime numbers < a in the first vector

    then add up all of the prime numbers in the first vector

    any help?



Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion