Skip to main content

Posts

Showing posts with the label prime number

A C++ program to input an integer 'n' and get the 'n'th prime number

#include <iostream> using namespace std; int main() {         int n;         cout<<"Input integer for n: ";         cin>>n;         int prime=0;         int count,count1=0;                 for(int x=1;;x++){                         count1=0;                         for(int y=1;y<=x;y++)                         {                                 if(x%y==0)                                 {                           ...