Our Blog Contain Detail about Some Technical Aspect like Programming, Blogger, Tools and Tip, Suggestion, Motivational, Health, Program in C and Java, Html

Write a program to print the entire prime no between 1 and 300.

Write a program to print the entire prime no between 1 and 300. 



Program in C language

#include<stdio.h>
#include<conio.h>

int IsPrime(int num)
{
     int i,b=1;
     for(i=2;i<num;i++)
     {
          if(num%i==0)
          {
               b=0;
               break;
          }

     }

     return b;

}

void main()
{
int i;

for(i=2;i<=100;i++)
{
 if(IsPrime(i))
{

     printf("%d\n",i);
}
}

}

Share:

No comments:

Post a Comment

Translate

Followers

Email Subscription

Enter your email address:

Delivered by FeedBurner

Recent Posts

Theme Support

Need our help to upload or customize this blogger template? Contact me with details about the theme customization you need.