Login Register






Thread Rating:
  • 0 Vote(s) - 0 Average


find out prime number with c programming filter_list
Author
Message
find out prime number with c programming #1
hey guys, this post is about to find out give number is prime or not, exept 2.

Code:
/*program is for finding given number is prime or not*/
main()
{
int x,y,z;
clrscr();
printf("\t\t\t*PROGRAM FOR FINDING PRIME NUMBER*\n\n");
printf("enter number:");
scanf("%d",&x);
y=x;
for (z=2;z<x;++z)
{
  if (x%z==0)
  break;
}
  if (z==y)
  printf("the given number is prime");
  else
  printf("the given number is not prime");
getch();
}

thanks for reading
[Image: 262s21x.jpg]

Reply

RE: find out prime number with c programming #2
(10-09-2011, 03:42 AM)esunly Wrote: I like this program. You are very critical to think of it.

thank you. if you need more help in c then pm me
[Image: 262s21x.jpg]

Reply

RE: find out prime number with c programming #3
According to me, it'll display 2 also as prime number.. So its perfect.
Folow me on My YouTube Channel if you're into art.

Reply

RE: find out prime number with c programming #4
This program is perfect... It'll work smoothly..

Reply







Users browsing this thread: 1 Guest(s)