A prime number is a number which is divisible only by itself
and 1. Examples of the first few primes are 2, 3, 5, 7, 11.
Consider writing a program which can generate prime numbers
for you. Your program should read in and set a maximum prime
to generate and a minimum number to start with when looking
for primes.
This program should be able to perform the following tasks:
1. Read the maximum number from user (keyboard input) to
look for primes. The program should not return any primes
greater than this number.
2. Read the minimum number from user (keyboard input) to
look for primes. The program should not return any primes
less than this number.
3. Generate and print out every prime number between the
maximum prime and minimum number specified by the user.


No Answer is Posted For this Question
Be the First to Post Answer

Post New Answer

More C++ General Interview Questions

What is the role of C++ shorthand's?

0 Answers   TCS,


Do we have to use initialization list in spite of the assignment in constructors?

0 Answers  


You have two pairs: new() and delete() and another pair : alloc() and free(). Explain differences between eg. New() and malloc()

0 Answers  


What is the difference between an external iterator and an internal iterator? Describe an advantage of an external iterator?

0 Answers  


If all is successful, what should main return a) 0 b) 1 c) void

0 Answers  






What is difference between malloc()/free() and new/delete?

0 Answers  


Write a program to add three numbers in C++ utilizing classes.

0 Answers   TCS,


Is it possible to use a new for the reallocation of pointers ?

0 Answers  


Am studying basic c++ programming, have been given the following assignment. Design a linear program to calculate the maximum stress a material can withstand given a force and a diameter of a circle. To find the required area pi should be defined. Have most of the program sorted out but am at a loss as to how to show the calculations required. Can anyone help?

0 Answers  


Is oops and c++ same?

0 Answers  


How many lines of code you have written for a single program?

4 Answers   BoA,


What is low level language in simple words?

0 Answers  


Categories