Thursday, August 16, 2012

Prime Number Generate

Assalamu Alaikum. Hope you all are well by the grace of Almighty ALLAH. Today we learn, how to find out the prime numbers between two limits. Take a look at the problem.

Problem: Write a program that prints the list of all prime numbers between X and Y, where Y > X. User will input the value of  X and Y. If  X is lower than Y a message will be given "Invalid Range".

A prime number is  a natural number greater than 1 that has no positive divisors other than 1 and itself.

Take a look at the program.

We can also do this program by using a flag. Take a look at the following program.

Thank You all..


Post a Comment