Link to home
Start Free TrialLog in
Avatar of Reddy4U-Solaris
Reddy4U-Solaris

asked on

Script Needed Urgent

simple script in a scripting language  that prints the numbers from 1 to 100. But for multiples of three print "Site" instead of the number and for the multiples of five print "Host". For numbers which are multiples of both three and five print "SiteHost".
ASKER CERTIFIED SOLUTION
Avatar of sjklein42
sjklein42
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Reddy4U-Solaris
Reddy4U-Solaris

ASKER

thanks thats usefull can u tell me which scripting u r using
Excellent Response
That's PERL.

Thanks.
Avatar of Tintin
bash version is virtually the same

#!/bin/bash
for i in $(seq 1 100)
do
  if [ $(($i%15)) -eq 0 ]
  then
     echo SiteHost
  elif [ $(($i%3)) -eq 0 ]
  then
     echo Site
  elif [ $(($i%5)) -eq 0 ]
  then
     echo Host
  else
     echo $i
  fi

don

Open in new window

e