6
Contributors
5
Replies
6
Views
10 Years
Discussion Span
Last Post by Narue
-1

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();
}
Votes + Comments
NO
0

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.

0

>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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.