Jump to content

scary link is scary

Case: NZXT Phantom PSU: EVGA G2 650w Motherboard: Asus Z97-Pro (Wifi-AC) CPU: 4690K @4.2ghz/1.2V Cooler: Noctua NH-D15 Ram: Kingston HyperX FURY 16GB 1866mhz GPU: Gigabyte G1 GTX970 Storage: (2x) WD Caviar Blue 1TB, Crucial MX100 256GB SSD, Samsung 840 SSD Wifi: TP Link WDN4800

 

Donkeys are love, Donkeys are life.                    "No answer means no problem!" - Luke 2015

 

Link to comment
https://linustechtips.com/topic/223610-fizzbuzz/#findComment-3063244
Share on other sites

Link to post
Share on other sites

i'm too stupid for this.

dude.... our systems are like... brothers o-o

Case: NZXT Phantom PSU: EVGA G2 650w Motherboard: Asus Z97-Pro (Wifi-AC) CPU: 4690K @4.2ghz/1.2V Cooler: Noctua NH-D15 Ram: Kingston HyperX FURY 16GB 1866mhz GPU: Gigabyte G1 GTX970 Storage: (2x) WD Caviar Blue 1TB, Crucial MX100 256GB SSD, Samsung 840 SSD Wifi: TP Link WDN4800

 

Donkeys are love, Donkeys are life.                    "No answer means no problem!" - Luke 2015

 

Link to comment
https://linustechtips.com/topic/223610-fizzbuzz/#findComment-3063292
Share on other sites

Link to post
Share on other sites

for ($i=1; $i <= 100; $i++) {	$bool = true;	if($i % 3 == 0){		echo "Fizz";		$bool = false;	}	if($i % 5 == 0){		echo "Buzz";		$bool = false;	}	if($bool)		echo $i;	echo "\r\n";} 

I'd do something like this in php, I can understand why some people wouldn't be able to come up with a solution though.

// TODO: Update signature to include PC buid.

Link to comment
https://linustechtips.com/topic/223610-fizzbuzz/#findComment-3066192
Share on other sites

Link to post
Share on other sites

I think you'll find that if you count the lines in the elseif version excluding the comments it's shorter than the non-elseif version though.  ;)

 

 

I guess you are right, especially if you do it this way:

for ($i=1; $i <= 100 ; $i++) { 	if($i % 15 == 0)     echo "FizzBuzz\r\n";	elseif ($i % 3 == 0) echo "Fizz\r\n";	elseif ($i % 5 == 0) echo "Buzz\r\n";	else                 echo $i . "\r\n";}

// TODO: Update signature to include PC buid.

Link to comment
https://linustechtips.com/topic/223610-fizzbuzz/#findComment-3068008
Share on other sites

Link to post
Share on other sites

Not really a repost, but we already had a lot of FizzBuzz contributions here on this forum

 

______________________________________

public class Fizzy {    public static void main (String [] args){        for(int i=1;i<=100;i++)System.out.println((i%3==0?"Fizz":"")+(i%5==0?"Buzz":"")+(i%3==0||i%5==0?"":i));    }}

or if you lose the whitespaces / linebreaks like Avratz ...

public class Fizzy{public static void main(String [] args){for(int i=1;i<=100;i++)System.out.println((i%3==0?"Fizz":"")+(i%5==0?"Buzz":"")+(i%3==0||i%5==0?"":i));}}

Mini-Desktop: NCASE M1 Build Log
Mini-Server: M350 Build Log

Link to comment
https://linustechtips.com/topic/223610-fizzbuzz/#findComment-3068624
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×