Thursday, August 16, 2012

Maximum & Minimum Prime between limits

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

Problem: Write a program that prints the maximum and minimum prime numbers between X and Y, where Y > X. If X is lower than Y a message will be given "Invalid Range".



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

Now, 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..



0 comments:

Post a Comment