C and C++

Moderators: None (Apply to moderate this forum)
Number of threads: 28629
Number of posts: 94611

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Help me plz Posted by soton1986 on 11 Mar 2006 at 8:40 AM
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

Report
Re: Help me plz Posted by gigo318 on 12 Mar 2006 at 7:37 PM
: 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?






 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.