Question

IN PERL Write a program that will ask the user for a number and will print...

IN PERL

Write a program that will ask the user for a number and will print all the integers in order starting from 1 until the number. Use the <> operator to ask for the user's input.

For this program you will write a countdown timer. Your time will count down from 1 minute (60 seconds) to 0. Once the timer gets to 0 seconds the system will display a message that reads: RING RING RING! -using do while-

0 0
Add a comment Improve this question Transcribed image text
Answer #1

use strict;
my $countdown = 1*60;
do
{
print "Enter Number: ";
my $num = <STDIN>;

for (my $i=1; $i <= $num; $i++) {
print "$i ";
}

$| = 1;

my $beginTime = time;
my $endTime = $beginTime + $countdown;


for (;;)
{
my $time = time;
last if ($time >= $endTime);
printf(" %02d:%02d:%02d",($endTime - $time) / (60*60),($endTime - $time) / (60) % 60,($endTime - $time) % 60,);
}

}while $countdown < 0;


printf(" ");
printf("RING RING RING!");

if you have any doubt then please ask me without any hesitation in the comment section below , if you like my answer then please thumbs up for the answer , before giving thumbs down please discuss the question it may possible that we may understand the question different way and we can edit and change the answers if you argue, thanks :)

Add a comment
Know the answer?
Add Answer to:
IN PERL Write a program that will ask the user for a number and will print...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Using Perl Program: Write a program with a subroutine to prompt the user for any message...

    Using Perl Program: Write a program with a subroutine to prompt the user for any message (like "what is your name?"). The sub will collect the user's answer and return it back to the call (in the main program above the subroutine). The sub does not accept any arguments. Print out the returned string (name) from the sub.

  • This program should ask the user for the maximum number to print out to and then...

    This program should ask the user for the maximum number to print out to and then print each evennumber starting from 0 to the maximum. You may want to use % operator which gives you the remainder. Some results of the operator is as follows: • 0 % 2 = 0 • 1 % 2 = 1 • 2 % 2 = 0 • 3 % 2 = 1 • 4 % 2 = 0

  • In Java Write a program that will ask the user for integers and print if the...

    In Java Write a program that will ask the user for integers and print if the integer is positive, negative or zero. The program should continue asking for integer until the user enters a negative value.

  • Java program should ask the user for the maximum number to print out to and then...

    Java program should ask the user for the maximum number to print out to and then print each evennumber starting from 0 to the maximum. You may want to use % operator which gives you the remainder. Some results of the operator is as follows: • 0 % 2 = 0 • 1 % 2 = 1 • 2 % 2 = 0 • 3 % 2 = 1 • 4 % 2 = 0

  • In c# create a program that generates a random number from 1 to 1000. Then, ask...

    In c# create a program that generates a random number from 1 to 1000. Then, ask the user to guess the random number. If the user's guess is too high, then the program should print "Too High, Try again". If the user's guess is too low, then the program should print "Too low, Try again". Use a loop to allow the user to keep entering guesses until they guess the random number correctly. Once they figure it, congratulate the user....

  • Write a program that asks the user to enter a number ofseconds.• There are...

    Starting Out with C++ (9th Edition)  Chapter 4, Problem 7PCWrite a program that asks the user to enter a number of seconds.• There are 86400 seconds in a day. If the number of seconds entered by the user is greater than or equal to 86400, the program should display the number of days in that many seconds.• There are 3600 seconds in an hour. If the number of seconds entered by the user is less than 86400, but is greater...

  • Write a perl program that prompts a user for a number and checks that number against...

    Write a perl program that prompts a user for a number and checks that number against three possibilities. If the number is divisible by 3, it should print fizz, if its divisible by 5 it should print buzz, and if its divisible by 3 and 5 it should print fizzbuzz. It should do nothing if none of those conditions are met. I need help with this.

  • 1. Write a program to add positive numbers. Ask the user to enter numbers greater than...

    1. Write a program to add positive numbers. Ask the user to enter numbers greater than zero. If a 0, is entered stop requesting numbers and display the total. If a number is entered that is less than 0, display the message ‘Number must be greater than 0’, then ask for another number to be entered. Repeat until a number greater than 0 or 0 is entered. use math lab so I can copy the answers

  • write in python Create a program that will ask the user for a list of integers,...

    write in python Create a program that will ask the user for a list of integers, all on one line separated by a slash. construct a list named "adj_numbers" which contains the users input numbers after subtracting 2 from each number. then print the resulting list. the input statement and print statement are given to you in the starting code. a sample run of the program is as follows: Enter a list of integers, separated by slashes: 7/3/6/8 resulting list:...

  • For Java - Write a program that creates an array of 10 integers. Ask the user...

    For Java - Write a program that creates an array of 10 integers. Ask the user to enter the subscript (index) of an element, then displays the element located at that subscript. If the subscript entered is out of bounds (less than 0 or greater than length - 1), display the message "Out of Bounds".

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT