logo Use SA10RAM to get 10%* Discount.
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Patriciaaa GloverrrScience
(5/5)

975 Answers

Hire Me
expert
ISAAC SSEKISAMBUPolitical science
(/5)

771 Answers

Hire Me
expert
Johan CornerOthers
(5/5)

638 Answers

Hire Me
expert
Jesse RosssEngineering
(5/5)

750 Answers

Hire Me
Python Programming
(5/5)

Write a program that accepts a number and outputs valid if it is 5-numbers long. Example 1: x = 1234

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Q1: Write a program that accepts a number and outputs valid if it is 5-numbers long. Example 1: x = 1234

 

Ans: Invalid

 

Example 2: x = 45321

 

Ans: Valid for processing

 

Q2: Modify the program in Q1 that adds all the digits of the entered number and display it in the form of an equation using loops?

 

For example: x = 56781

 

Ans: 5+6+7+8+1 = 27

 

Another example: x = 12345

 

Ans: 1+2+3+4+5 = 15

 

Note: the left-hand side of the answer must be dynamic.

 

Q3: Modify the program that you have written in Q1 to capture below scenarios:

 

1) If there is a number 2 in the entered number, then do not add.

 

For example: x = 73251

 

Ans: 7+3+5+1= 16

 

2) If there is a number 9 in the entered number, then multiply it by 2 and add. For example: x =12949

 

Ans: 1+2+18+4+18 = 43

 

See how I multiplied 9 with 2 two times.

 

(5/5)
Attachments:

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme

Get Free Quote!

323 Experts Online