Slinky Posted March 4, 2008 Report Share Posted March 4, 2008 Im making this topic because i suck at C++ and i dont want to fail the class that im in so if any of you guys know anything id appreciate the help. Quote DD M4 Rockford Fosgate P500-4 SoundQubed HDC415 w carbon fiber cap 2 Rockford Fosagate T1675-S XS Power D3400 Under Hood XS Power D5100 in rear Michael Singer 200A Alt Build Log: http://www.stevemeadedesigns.com/board/topic/153901-2012-veloster-update-842013-wall-build-4-15s/ Link to comment Share on other sites More sharing options...
Slinky Posted March 4, 2008 Author Report Share Posted March 4, 2008 Exercise-3. Prime numbers Write a program that finds and prints the first 25 prime numbers, five numbers per line. Use the following logic: Let N be a number you wish to examine if it is a prime number. For this you check if that number is exactly divisible by any of the numbers from 2 to N/2. Once you find it is divisible, you can stop going further since that number is not a prime number. However, if the number is not exactly divisible by any of the numbers from 2 to N/2, then it is a prime number. You need to keep a count of the prime numbers found since you need just the first 25 prime numbers only. how do you do this part? Quote DD M4 Rockford Fosgate P500-4 SoundQubed HDC415 w carbon fiber cap 2 Rockford Fosagate T1675-S XS Power D3400 Under Hood XS Power D5100 in rear Michael Singer 200A Alt Build Log: http://www.stevemeadedesigns.com/board/topic/153901-2012-veloster-update-842013-wall-build-4-15s/ Link to comment Share on other sites More sharing options...
dwright27 Posted March 4, 2008 Report Share Posted March 4, 2008 FUCK! wish i could help. 1 3 5 7 11 17 23 29 31 34 37 39 41 43 47 51 53 57 59 61 69 71 something like that ^^^^ Quote 2006 F-150 4 DC XL M2 18's Walled Daily Driver XS Power 4 DC 3.5kw Team DC Team S.P.L. Lot of Audio Technix and 1/0 DC Audio Dealer American Bass Dealer XS Power Dealer Audio Technix Dealer Link to comment Share on other sites More sharing options...
Slinky Posted March 4, 2008 Author Report Share Posted March 4, 2008 lol. thanks man. i got my program to list the prime numbers but i dont know how to make it to where there is 5 columns. Quote DD M4 Rockford Fosgate P500-4 SoundQubed HDC415 w carbon fiber cap 2 Rockford Fosagate T1675-S XS Power D3400 Under Hood XS Power D5100 in rear Michael Singer 200A Alt Build Log: http://www.stevemeadedesigns.com/board/topic/153901-2012-veloster-update-842013-wall-build-4-15s/ Link to comment Share on other sites More sharing options...
dwright27 Posted March 4, 2008 Report Share Posted March 4, 2008 maybe under format or something? if theres a format? then columns? Quote 2006 F-150 4 DC XL M2 18's Walled Daily Driver XS Power 4 DC 3.5kw Team DC Team S.P.L. Lot of Audio Technix and 1/0 DC Audio Dealer American Bass Dealer XS Power Dealer Audio Technix Dealer Link to comment Share on other sites More sharing options...
Slinky Posted March 4, 2008 Author Report Share Posted March 4, 2008 (edited) i need to get this list into 5 columns here is my code so far /** Lab-5: lab5-3.cpp : Prime numbers *Author: -(Replace this with your name here) * Date: (replace this with today’s date) *********************************************************/ #include <iostream> #include <string> #include <iomanip> using namespace std; int a, b, c; int main () { const int NUMBER_OF_PRIMES = 25; const int NUMBER_OF_PRIMES_PER_LINE = 5; int count = 0; // for counting the prime numbers int number = 2; // starting number for prime number checking cout << "The first 25 prime numbers are: " << endl; cout<<endl; for (a=3; a <= 125; a++) { for (b = 2; b < a; b++) { if ((a% == 0) c = 0; } if (c != 0) cout << a << endl; c=1; } return 0; } Edited March 4, 2008 by Slinky Quote DD M4 Rockford Fosgate P500-4 SoundQubed HDC415 w carbon fiber cap 2 Rockford Fosagate T1675-S XS Power D3400 Under Hood XS Power D5100 in rear Michael Singer 200A Alt Build Log: http://www.stevemeadedesigns.com/board/topic/153901-2012-veloster-update-842013-wall-build-4-15s/ Link to comment Share on other sites More sharing options...
Guest MegaloManiac Posted March 4, 2008 Report Share Posted March 4, 2008 (edited) i can solve this for you, but you will have to throw some money towards my way via paypal cause it is considered cheating Edited March 4, 2008 by MegaloManiac Quote Link to comment Share on other sites More sharing options...
Torres Posted March 5, 2008 Report Share Posted March 5, 2008 i can solve this for you, but you will have to throw some money towards my way via paypal cause it is considered cheating lolol so shady... Quote Link to comment Share on other sites More sharing options...
RollinSoLow Posted March 5, 2008 Report Share Posted March 5, 2008 lolol so shady... sounds like my sons report card c+ f c- f c + Quote Link to comment Share on other sites More sharing options...
Guest MegaloManiac Posted March 5, 2008 Report Share Posted March 5, 2008 eitherway my offer is on the table its up to him. i do have the code done Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.