Prime No

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

#include <iostream>

using namespace std;

int main()
{

int num,i,j,ft;

cin >> num; // Reading input from STDIN

cout << "Input number is " << num << endl; // Writing output to
STDOUT

for(i=1;i<=num;i++)
{

ft=0;

for(j=1;j<=num;j++)

if(i%j==0)

ft++;

if(ft==2)

cout<<i<<" ";

return 0;

You might also like