#include <conio.h> #include <iostream> using namespace std; int n_prime(int n_last); int main(int argc, char *argv[]) { int your_num; cout"Enter No= "; cin>>your_num; cout n_prime(your_num); system("PAUSE"); return EXIT_SUCCESS; } int n_prime(int n_last){ int count,x; count=0; for(x=2;x<=n_last/2;x++){ if(n_last%x==0){ count++; break; } } if(count==0){ cout"Prime"endl; }else{ cout"Composite"endl; } } { public: Stack() { size = 10; current = -1;} //constructor int pop(){ return A[current--];} // The pop function void push(int x){A[++current] = x;} // The push function int top(){ return A[current];} // The top function int isEmpty(){return ( current == -1 );} // Will return true when stack is empty int isFull(){ return ( current == size-1);} // Will return true when stack is full { 1. int x = head->get(); 2. Node * p = head; 3. head = head->getNext(); 4. delete p; 5. return x; } void push(int x) { 1. Node * newNode = new Node(); 2. newNode->set(x); 3. newNode->setNext(head); 4. head = newNode; }</iostream></conio.h>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)