Preview:
#include<iostream>
using namespace std;
void prime(int n){
    bool flag=true;
    for(int i=2;i<n;i++){
        if(n%i==0){
            flag=false;
            break;
        }
    }
    if(flag==false){
        cout<<"No it is not a prime no.\n";
    }
    else{
        cout<<"Yes it is a prime no.\n";
    }
}
int main(){
    int a;
    cout<<"Enter the no.\n";
    cin>>a;
    prime(a);
    return 0;
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter