display « 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 » display 

1. using nested for loop, workin with displaying prime numbers    bytes.com

Hey. Im trying to make program that basically displays all the prime numbers. I need to use bool and for but im not quite sure if i have this right. So far i have this bunch of a mess but can anyone point me in the right direction? Thanks! # include # include using namespace std; int i; //int ...

2. Need Some Coaching, Display 100 Prime Numbers    cboard.cprogramming.com

#include int main (void) { int num, test; int prime = 0; int not_prime = 0; for (num = 2; num < 100; num++) { for (test = 2; test < (num - 1); test++) { if (num % test == 0) { printf ("%d\n", num); break; } } //printf ("%d\n", num); } }

3. why the prime numbers cant be displayed?    cboard.cprogramming.com

#include #include int is_prime(int n); void main() { int x; printf("How many prime numbers? "); scanf("%d", &x); printf("\n %d prime numbers: ",x); int j=1; int i=1; for(i=1;i<=x;i++) { printf("\n %d :",i); for(j=1;is_prime(j)==0;j++) { if(is_prime(j)==1) printf("%d",j); } } system("PAUSE"); } //function definition int is_prime(int n) { int k, limit; if(n==1) return 0; if(n==2) return 1; if(n%2==0) return 0; limit =n/2; ...

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.