Binary Nature where the analog and digital bits of nature connect

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Sunday, 25 October 2009

First Post!!!

Posted on 15:23 by Unknown
I thought I would submit my solution for the FizzBuzz test. I've used PowerShell and VBScript for the solution since the majority of my "dev" work is Windows sysadmin scripting.

FizzBuzz for PowerShell:
001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
for ($i = 1; $i -le 100; $i++)
{
    if (($i % 3 -eq 0) -and ($i % 5 -eq 0)) 
    { 
        Write-Host "FizzBuzz" 
    }
    elseif ($i % 3 -eq 0) 
    { 
        Write-Host "Fizz" 
    }
    elseif ($i % 5 -eq 0) 
    { 
        Write-Host "Buzz" 
    }
    else { $i }
}

... and VBScript:
001
002
003
004
005
006
007
008
009
010
011
012
013
Dim i

For i = 1 To 100
    If ((i Mod 3 = 0) And (i Mod 5 = 0)) Then
        WScript.Echo "FizzBuzz"
    ElseIf (i Mod 3 = 0) Then
        WScript.Echo "Fizz"
    ElseIf (i Mod 5 = 0) Then
        WScript.Echo "Buzz"
    Else
        WScript.Echo i
    End If
Next

Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in | No comments
Newer Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • Cisco ASA SSL VPN with Active Directory
    There is little doubt the bring-your-own-device (BYOD) strategy is becoming a popular method to access company resources. As technical prof...
  • Integrate VMware Fusion with GNS3 on your Mac
    At long last, we can finally integrate VMware Fusion with GNS3. VMware Workstation for Windows and Linux has had this capability for quite s...
  • Get Exchange Server Version and Update Info with PowerShell
    I prefer not to "reinvent the wheel", so I spent quite a bit of time searching the web for available code that would perform the t...
  • PowerShell Function for Windows System Memory Statistics
    Memory is one of the four primary hardware resources an operating system manages. The other three are cpu, disk, and network. Analysis of sy...
  • Enable sudo for RHEL and CentOS
    Sudo is an arguably safer alternative to logging in (or using the su command) to the root account. Sudo allows you to partition and delegat...
  • Install Request Tracker 4 on Ubuntu Server
    The CentOS6/RT4 blog post has generated terrific feedback, so I figure an Ubuntu (and Debian) distribution port is essential. The core com...
  • Compile and install Wireshark on Fedora and Ubuntu Linux
    Wireshark is the world’s most popular network analyzer. Almost every computer professional comes to a point when a network protocol analyzer...
  • Install Request Tracker 4
    The argument could be made Request Tracker is the de facto standard when it comes to issue tracking systems. Maybe the only drawback of RT ...
  • SSL VPN configuration on Cisco ASA with AnyConnect VPN client
    This post will describe how to setup a Cisco Adaptive Security Appliance (ASA) device to perform remote access SSL VPN with the stand-alone ...
  • Find Active Directory Administrator Users in DSRM
    My previous post detailed the steps of how to recover from a "lost" password for the default built-in Active Directory Administra...

Categories

  • AD
  • Apache
  • AWS
  • Cisco
  • Exchange
  • FFmpeg
  • GNS3
  • Linux
  • Mac
  • MariaDB
  • MySQL
  • PowerShell
  • RT
  • Security
  • SSH
  • VMware
  • Windows
  • Zenoss

Blog Archive

  • ►  2013 (8)
    • ►  October (1)
    • ►  September (1)
    • ►  August (1)
    • ►  May (1)
    • ►  April (1)
    • ►  March (1)
    • ►  February (1)
    • ►  January (1)
  • ►  2012 (3)
    • ►  December (1)
    • ►  November (1)
    • ►  April (1)
  • ►  2011 (3)
    • ►  June (1)
    • ►  May (2)
  • ►  2010 (8)
    • ►  August (1)
    • ►  July (1)
    • ►  June (1)
    • ►  May (1)
    • ►  April (1)
    • ►  March (1)
    • ►  February (1)
    • ►  January (1)
  • ▼  2009 (3)
    • ►  December (1)
    • ►  November (1)
    • ▼  October (1)
      • First Post!!!
Powered by Blogger.

About Me

Unknown
View my complete profile