Thread: program for primes?

  1. #1
    Registered User
    Join Date
    Dec 2002
    Posts
    1

    program for primes?

    how can someone make a program that inputs from the screen two whole numbers and outputs all the prime numbers between both numbers

  2. #2
    Registered User abrege's Avatar
    Join Date
    Nov 2002
    Posts
    369
    wheeee

    Code:
    	for(int x = min; x <= max; x ++)
    	{
    		total = 2;
    
    		for(int y = 2;y < x; y ++)
    		if(x % y != 0) total ++;
    
    		if(total == y && x > 0)
    		cout << x << endl;
    	}
    I am against the teaching of evolution in schools. I am also against widespread
    literacy and the refrigeration of food.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Issue with program that's calling a function and has a loop
    By tigerfansince84 in forum C++ Programming
    Replies: 9
    Last Post: 11-12-2008, 01:38 PM
  2. Need help with a program, theres something in it for you
    By engstudent363 in forum C Programming
    Replies: 1
    Last Post: 02-29-2008, 01:41 PM
  3. Replies: 4
    Last Post: 02-21-2008, 10:39 AM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM