By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,178 Members | 971 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,178 IT Pros & Developers. It's quick & easy.

Hi, need Perl program ?

P: 1
I have a Perl program that needs to have a start and stop as two variables and all the numbers between these two to be added. The start and stop must be whole numbers .The sum of all the numbers between the start and stop variables should be added to find the sum except all the numbers which are exactly divisable by 7 are not added to the sum.
I have this so far:
Expand|Select|Wrap|Line Numbers
  1.  print "Enter the start number";
  2.  $start=<STDIN>;
  3.  print "Enter the stop number";
  4.  $stop=<STDIN>;
  5.  $sum=0;
  6.  $count=0;
  7.  if ($sum % 7!=0) {
  8.    $sum=$sum+$start;
  9.    $start=$start+1;
  10.  else ($sum<=$stop)
  11.    $sum=$sum+$start;
  12.    $start=$start+1;
  13.  }
  14.  exit;
Feb 8 '10 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 2.5K+
P: 3,503
Ok, do you have a question associated with your task?

Unfortunately, since this sounds far too much like class work, we cannot just give you code, you have to do the work. You ask questions.... we help you.


Feb 9 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.