1 to 100 prime numbers?

c language

3 Answers

Relevance
  • 1 decade ago
    Favorite Answer

    main()

    {

    int a,c=0,i,j,n;

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

    {

    scanf("%d",&j);

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

    {

    a=n%i;

    if(a=0)

    {

    c=c+1;

    }

    }

    if (c=2)

    printf("%d \t");

    }

    }

    The prime numbers will be printed with a tab space.

  • 1 decade ago

    1, 3, 7, 11, 13, 17, 19, 23 .... a prime number is one that cannot be divided by any numbers other than 1 and itself, to give you a whole number as an answer and not a fraction.

    Source(s): Primary school maths
  • Anonymous
    1 decade ago

    A prime number is an integer with no integer factors except itself and one. With this knowledge you should now be able to complete your programming homework on your own.

    Rawlyn.

Still have questions? Get your answers by asking now.