Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using HTML and external JavaScript file CODE this. Please help me! This is the first one: This is a 2 one: (These are 2 different

Using HTML and external JavaScript file CODE this. Please help me!
This is the first one:
image text in transcribed
This is a 2 one:
image text in transcribed
(These are 2 different ones)
1. Read the input from the document. This string must be between 10 and 20 characters long, inclusive, and consist of only 0 's and 1 's. If the string does not meet these conditions, output the result 0 . If the input is valid then interpret it as a binary number. Using only loops and substring operations calculate the integer value of the binary number. For simplicity, we will assume "little endian" numbers ... the smallest number is on the left and get bigger moving to the right. Recall that binary values are powers of 2 , with the first few values being 2=1,21=2,20+21=3, etc. 2. Read the input from the document. If it is an integer, split the absolute value of the integer apart and add up all the digits. If the resulting sum is greater than 9 , repeat this process until the result is a single digit. Output the result of the calculation. If the original input was not an integer output "Bad input

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database And Transact SQL

Authors: Lucy Scott

1st Edition

1974679985, 978-1974679980

More Books

Students also viewed these Databases questions