including the 2 conditions that r chekd for prime numberS

Recommended Answers

All 5 Replies

with some code or description of what you've attempted

Hey aaisha,
You Can Try this

#include <stdio.h>
main()
{
         int n,i=1,j,c;
         clrscr();
         printf("Enter Number Of Terms");
         printf("Prime Numbers Are Follwing");
         scanf("%d",&n);
         while(i<=n)
         {
            c=0;
            for(j=1;j<=i;j++)
            {
              if(i%j==0)
                  c++;
             }
           if(c==2)
           printf("%d    ",i)
           i++;
        }
        getch();
}
commented: NO -2

>You Can Try this
No, he can not, because it won't compile.

Praneeth you should use code tags for posting your code. This is the third time I have edited your post to add code tags. Take some time to read the forum announcements and the stickies at the top of the forum before posting again.

>Hey aaisha,
>You Can Try this
*sigh*

1) Your code is awful. Please get a newer compiler and learn C properly before trying to help people. You'll end up giving them bad habits.

2) Don't do other people's work for them. Please understand that the OP can now steal your code and turn it in for a grade. Keep that in mind when you post solutions.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.