Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Program For Prime No. Series Up to N no ...........

 Program to print the series of Prime Number up to ' n '  number.Here user can input the end limit of series, so for what you waiting for..(keep enjoy)
simply use of two for loop and if else operator
 condition " i%j==0 "helps to determine the Prime no. Any further query leave message....

 

Source Code:-

#include<iostream.h>
#include<conio.h>
void main()
{clrscr();
 int n,count=0;
 cout<<"PRIME NO. SERIES by-Tarun Rawat\n";
 cout<<"\nINPUT THE VALUE OF N: " ;
 cin>>n;
 cout<<"\nTHE PRIME NO. SERIES B/W 1 TO"<<n<<"\n";
 for(int i=1;i<=n;i++)
   {for(int j=1;j<=i;j++)
{ if(i%j==0)
     count++;
}
if (count==1||count==2)
   cout<<i<<" ";
    count=0;
   }
getch();
}



No comments:

Post a Comment

Blogger Widgets

Find Us On Google, Just type - way2cplusplus -

If you have any questions on implementing or understanding this C++ Program , shoot me a comment and I'll be glad to help! :) :)