Hello experts,
I am in need of some assistance on how start this off.
Prompt user to enter 10 random numbers
add only the even numbers
multiply the odd numbers
Hello experts,
I am in need of some assistance on how start this off.
Prompt user to enter 10 random numbers
add only the even numbers
multiply the odd numbers
perldoc perlintro
perldoc perlop
and anything that a search for "Perl tutorial" might come up with. Also, you might want to re-read the forum rules, esp. Rule 6.
Hope below can help you some
#!/usr/bin/perl
print "Input number\n";
while(<>){
chomp;
exit if $_ eq "q";
print 2 * $_ if $_ % 2 ==0;
print 3 * $_ if $_ % 2 !=0;
print "Input another\n";
}
You shouldn't do students work for them. Instead tell them to look into the modulus operator or other tips, but just writing the code for them is not appropriate. Especially when they demonstrate no effort at all to write such a simple little program.
summer_cherry is an incorrigible altruist. What can one do?
Ban him/her from the forum for doing students work for them. It should be just as bad a violation, or worse, than posting the schoolwork. But black is white and white is black in this cazy world. Oh well. ![]()