Identify all of the substrings that form numbers

Assignment Help Operating System
Reference no: EM13945549

Could you explain or convert each of the code , symbols used in the following solution?
For example what would "itiny_mce_markerquot; mean for me?
i=1 TO LEN(i$) etc
What would j mean for me? etc
i + 1 TO 1 STEP - 1 etc
MOD 3) = 0 THEN PRINT MID$(i$, i, j) etc

Given a string of numbers, identify all of the substrings that form numbers that are divisible by 3. For example, applying the algorithm on the string 37540 should produce the following substrings (not necessarily in this order): 0; 3; 75; 54; 375; 540

1 i$ = "37540" 'input string
2 FOR i = 1 TO LEN(i$) 'loop from 1 to the length of the input string
3 FOR j = LEN(i$) - i + 1 TO 1 STEP -1
4 'loop from the lenght from this point in the string to the end, down to 1
5 IF (VAL(MID$(i$, i, j)) MOD 3) = 0 THEN PRINT MID$(i$, i, j)
6 'using the modulo function, we check if the particular number is
'evenly divisible by 3
7 NEXT j 'end looping
8 NEXT i 'end looping

For example: 5469
5+4+6+9=24
2+4=6
therefore 5469 is evenly divisible by 3 or 5469 MOD 3 = 0

Reference no: EM13945549

Questions Cloud

Describe an efficient erew algorithm to form a list : Consider an n-element list in an n-processor EREW parallel random-access machine, where some elements of the list are marked as being blue. Describe an efficient parallel algorithm to form a new list consisting of all the blue elements.
Possibility of improving the properties by modifying : Describe the composition, crystal structure & its typical defects, microstructure & phases; properties important for the selected applications, their dependence on the structure, possibility of improving the properties by modifying the structure a..
Define the schengen agreement - what is it : Define the Schengen Agreement: What is it? Why was it put in place? How does it aim to achieve the EU goal of an "ever closer union?" What is Frontex? What is being proposed as a replacement, and why
What are two types of air pollutants : Are the selected air pollutants considered primary or secondary pollutants and why they are considered to be primary or secondary and discuss the sources of these pollutants?
Identify all of the substrings that form numbers : Could you explain or convert each of the code , symbols used in the following solution?
Estimating required rates of return for projects : The Opinion and Analysis section should demonstrate your critical thinking and analysis of the subject matter - the Overview/Summary section should include a statement of the author's hypothesis or proposition.
Upper spec limit and lower spec limit : Calculate Cp (Capability ratio) and Cpk (Capability index) from the following data:
Statistical difference exist between vendors : Perform an ANOVA analysis on the data at p=0.01 to determine if any statistical difference exist between vendors.
What are some takeaways in building an oil refinery : What are some economic, environmental, and political issues in building an automotive manufacture plant? Could the auto planet propose better opportunities for towns people that have lost their job?

Reviews

Write a Review

Operating System Questions & Answers

  Implementation of algorithms for process management

The Shortest Job Next (SJN) algorithm queues processes in a way that the ones that use the shortest CPU cycle will be selected for running rst.

  Develop a user mode command interpreter

Develop a user mode command interpreter which support list-short.

  Memory allocation in operating system

Analysis and implementation of algorithms for memory allocation in operating system, Explain First- t and best- t methods are used in memory allocation in operating systems.

  Stand alone child process

Forking the child process

  Write a multi-threaded program

Write a multi-threaded program to solve producer and consumer problem

  Marginal and average cost curves

n a competitive market place (pure competition) is it possible to continually sell your product at a price above the average cost of production.

  Simulating operating systems scheduling

Simulate the long-term scheduler, the short-term scheduler and the I/O scheduler of the computer using the First-Come-First-Serve algorithm.

  Issues with trusted platform module

Research paper discussing the issues with Trusted Platform Module (TPM)

  Threads

Explain a complication that concurrent processing adds to an operating system.

  Design and programming

Use the semaphore methods to control the concurrency of the solution

  Virtual machines

Virtual machines supported by a host operating system

  Discuss an application that benefits barrier synchronization

Discuss an application that would benefit from the use of barrier synchronization

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd