Register | Sing In

New posts

Stacks in C programming Linked Lists in C programming File Input/Output in C programming Check prime numbers in C Programming C Programming Enumeration C Programming Union

Archives

2013-10 2013-09 2013-08

perl

October 14, 2014 Posted by: Jasmine Views: 405

 

Prompt the user to enter a sequence of numbers (between 1 and 20) and/or letters (lower or uppercase), each number or letter is separated by a space, and the length of the sequence can vary. The user ends the sequence with a "q" or "Q", followed by a space. (Assume that the user always enters a "q" or "Q" followed by a space.)

 

  • Do NOT use regular expressions
  • Do NOT use arrays


Your script output for the example above should be:


1+12+2+5 = 20

Test your script with the following input (6 different test cases):

1 12 a 2 5 P Q output should be: 1+12+2+5 = 20
1 3 A t 4 q output should be: 1+3+4 = 8
c 1 Q output should be: 1 = 1
a b c d Q output should be: no valid number entered   (or some similar error statement)
1 2 34 q 4 5 6 output should be: 1+2 = 3
22 q 5 6 output should be: no valid number entered   (or some similar error statement)

Best Answer

No answer

Online Chat

LiveZilla Live Help

Popular posts

Function strtok in C programming Check prime numbers in C Programming C Programming Union Linked Lists in C programming File Input/Output in C programming C Programming Enumeration

RSS-subscribe

New materials

Subscribe