Friday, August 1, 2014

program for prime number from 1 to 100 in c

write a program to find the prime number from 1 to 100 in c?
        #include<stdio.h>
       #include<conio.h>
      main()
           {
               int i,j,f;
            for(i=1;i<=100;i++)
              {
                f=0;
              for(j=1;j<=i;j++)
                 {
                      if(i%j==0)
                        f=f+1;
                     }
                    if(f==2)
                       {
                          printf("The No Is Prime  %d\n",i);
                         }
                }
      getch();
}

No comments:

Post a Comment

Featured Post

What is JavaScript? What is the role of JavaScript engine?

  The JavaScript is a Programming language that is used for converting static web pages to interactive and dynamic web pages. A JavaScript e...