468,496 Members | 1,798 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,496 developers. It's quick & easy.

Please Discribe This Program For Me

Expand|Select|Wrap|Line Numbers
  1.  #include<stdio.h> 
  2. #include<math.h>
  3. #define mod %
  4. int main()
  5. {
  6.     unsigned char flag,counter=0,rows=0;
  7.     long unsigned int number,i,j;
  8.     printf("\n\t Enter your number:");
  9.     scanf("%du",&number);
  10.     for(i=1;i<=(long unsigned int)abs(number);i++)
  11.     { 
  12.         flag=0;
  13.         j=2;
  14.         while(j<=(long unsigned int)sqrt(i))
  15.         {
  16.             if(i mod j==0)
  17.             {
  18.                 flag=1;
  19.                 break;
  20.             }
  21.             j++;
  22.         }
  23.         if(flag==0)
  24.         {
  25.             printf("%10lu",i);
  26.             counter++;
  27.             if(counter==10)
  28.             {
  29.                 printf("\n");
  30.                 counter=0;
  31.                 rows++;
  32.             }
  33.             if(rows==20)
  34.             {
  35.                 rows=0;
  36.                 printf("\n\t\t Press any key to view next page... \n");
  37.             }
  38.         }
  39.     }
  40.     printf("\n");
  41.     return 0;
  42. }
  43.  
Oct 22 '06 #1
0 796

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

20 posts views Thread by da Vinci | last post: by
7 posts views Thread by tyler_durden | last post: by
reply views Thread by raa abdullah | last post: by
3 posts views Thread by marsguy85 | last post: by
5 posts views Thread by mohammaditraders | last post: by
reply views Thread by NPC403 | last post: by
3 posts views Thread by gieforce | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.