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".
Perl

Avatar of undefined
Last Comment
Tintin

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
sjklein42

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Reddy4U-Solaris

ASKER
thanks thats usefull can u tell me which scripting u r using
Reddy4U-Solaris

ASKER
Excellent Response
sjklein42

That's PERL.

Thanks.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
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