determine « prime « C Data Type Q&A

Home
C Data Type Q&A
1.binary
2.bit
3.byte
4.char
5.character
6.decimal
7.Development
8.float
9.hex
10.integer
11.prime
12.random
13.struct
C Data Type Q&A » prime » determine 

1. C - determine if a number is prime    stackoverflow.com

I am trying to come up with a method that takes an integer and returns a boolean to say if the number is prime or not and I don't know much ...

2. determine if numbers are prime    cboard.cprogramming.com

#include #include int main() { int a,c=1,i,number; char answer; do { { printf("Enter number:"); scanf("%d", &number); getchar(); for(i=1;i<=number;i++) { a=number%i; if(a==0) { c=c+1; } } if (c==3) printf(" PRIME NUMBER\n"); else printf(" NOT PRIME NUMBER\n"); } printf("Do you want to continue?(y/n)"); scanf("%c", &answer); getchar(); } while (tolower(answer) == 'y'); {while(answer == 'n') { printf("Have a good day!\n"); break; } ...

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.