Friday 24 June 2016

C++ Program - To find Prime Number or Not

#include
using namespace std;
int main() {
    int number,count=0;
cout<<"Enter a NO. to check Prime or Not ";
    cin>>number;
    for(int a=2;a<=number/2;a++) {
        if(number%a==0) {
            count++;
            break;
        }
    }
    if(count==0) {
        cout<    } else {
        cout<    }
    return 0;
}

No comments:

Post a Comment

CakePHP Date Picker

Folder Structure: Controller:   File location - cakephp/src/controller/HomepageController.php namespace App\Controller; use...