Selasa, 24 Maret 2015

#include #include #include using namespace std; bool Prima(int x){ int k, y; bool test; if(x <2){ return false; } else if(x==2){ return true; } else{ y=ceil(sqrt(x)); test=true; while(test==true && y>=2){ if(x%y==0){ test=false; } else{ y=y-1; } } } return test; } int main(int argc, char *argv[]) { int bil; cout<<"Masukan bilangan yang akan di test: "; cin>>bil; cout<<"hasilnya adalah= "<

Tidak ada komentar:

Posting Komentar