Jump to content

Recommended Posts

Posted

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.

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/

Posted

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?

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/

Posted

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 ^^^^

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

DWRIGHT-1-1.jpg

Posted

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.

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/

Posted

maybe under format or something?

if theres a format?

then columns?

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

DWRIGHT-1-1.jpg

Posted (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%B) == 0)

c = 0;

}

if (c != 0)

cout << a << endl;

c=1;

}

return 0;

}

post-360-1204666323_thumb.jpg

Edited by Slinky

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/

Guest MegaloManiac
Posted (edited)

i can solve this for you, but you will have to throw some money towards my way via paypal :P cause it is considered cheating

Edited by MegaloManiac
Posted
i can solve this for you, but you will have to throw some money towards my way via paypal :P cause it is considered cheating

lolol so shady...

 

 

Guest MegaloManiac
Posted

eitherway my offer is on the table its up to him. i do have the code done :D

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Who's Online   0 Members, 0 Anonymous, 6349 Guests (See full list)

    • There are no registered users currently online
×
×
  • Create New...