can any body provide program for first 100 (not 1 to 100)prime numbers in c?

2 Answers

Relevance
  • Will H
    Lv 7
    8 years ago
    Favorite Answer

    #include<stdio.h>

    int main()

    {

    int num,n,div,p;

    printf("Enter any number: ");//enter 100

    scanf("%d", &num);

    printf("\n");

      for(n=2; n<=num; n++)

      {

       if(n ==2)

         p=1;

       for(div=2; div<n; div++)

       {

         if(n%div==0)

         {

           p=0;

           break;

         }

         p=1;

       }

       if(p)

         printf("\t%d\n",n);

      }

    return 0;

    }

    If you copy and paste remember to edit out white spaces needed for Y/A display purposes

  • Anonymous
    8 years ago

    include "orga.h"

    {

    decalere a

    void

    printf("prime numbers"}

    void

Still have questions? Get your answers by asking now.