1. Ask user to Define Lower Bound

2. Ask User to Define Upper Bound

## Structure of the Problem Requirements

Prime Numbers are those Numbers which only Divisible with 1 and the Number itself. In this Problem the Program ask User to define two Bounds to Check how many Prime Numbers are their in this Range.

## Source Code

#include <iostream>

using namespace std;

int main()

{

int number1,number2;

cout<<endl<<endl<<"**************** PRIME NUMBER **************"<<endl<<endl;

cout<<"Please Enter Lower Bound: ";

cin>>number1;

cout<<"Please Enter Upper Bound: ";

cin>>number2;

while(number1<number2)

{

if(number1==2)

{

cout<<"2"<<endl;

}//if(number1==2)

for (int count=2; count<number1; count++)

{

if (number1 % count == 0)

{

break;

}//if (number1 % count == 0)

else

{

if (number1 == count+1)

cout << number1 <<endl;

}//end else

}//for (int count=2; count<number1; count++)

number1++;

}//while(number1<number2)

return 0;

}

## Output of the Program

Prime Number |

Asad Niazi is Software Engineer , Programmer, Web Developers and a young mentor of Tech Solutions Desk and Blogging Solutions . Asad Love to writes about Technology, Programming, Blogging and make money online.

## 0 comments:

## Post a Comment