-2 Reputation Points
- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
0% Quality Score
- Upvotes Received
- 0
- Posts with Upvotes
- 0
- Upvoting Members
- 0
- Downvotes Received
- 1
- Posts with Downvotes
- 1
- Downvoting Members
- 1
1 Posted Topic
Re: Those other solutions are abit too complex?!! This counts all your prime nums from 0 to 100 [code] [COLOR=#0000ff]#include[/COLOR][COLOR=#000000] <[/COLOR][COLOR=#800000]iostream> [/COLOR][COLOR=#0000ff]int[/COLOR][COLOR=#000000] main()[/COLOR] { [COLOR=#0000ff]int[/COLOR] freq=0; [COLOR=#0000ff]for[/COLOR]([COLOR=#0000ff]int[/COLOR] i=1;i<100;i++){ [COLOR=#0000ff]int[/COLOR] isZero=0; [COLOR=#0000ff]for[/COLOR] ([COLOR=#0000ff]int[/COLOR] j=1;j<i;j++) { [COLOR=#0000ff]if[/COLOR] (i%j==0) isZero++; } [COLOR=#0000ff]if[/COLOR] (isZero ==1) { freq++; } } std::cout << [COLOR=#800000]"The Frequecy of Prime … |