Find all of the substrings that form numbers

Assignment Help Computer Engineering
Reference no: EM1334997

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: EM1334997

Questions Cloud

Explain an industry from the food and beverage or technology : Explain an industry from the Food and beverage and Technology
Assume that some nodes in an n-node binary tree : 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. define an efficient parallel algorithm to form a new list consisting of all the blue elements.
Related to bankruptcy : Who may file bankruptcy? How has this changed over the past few years?
Improving business decision-making processes : How would an information system, including timely and accurate accounting information, improve the business decision-making processes at your organization?
Find all of the substrings that form numbers : Given a string of numbers, identify all of substrings that form numbers that are divisible by 3. For instance, applying the algorithm on the string 37540 should produce the following substrings (not necessarily in this order): 0; 3; 75; 54; 375; 5..
Explain kouzes-posner model of leadership : Assistance in preparing a Position paper on the applicability of the Kouzes-Posner Model of Leadership?
E-biz of google : From the e-biz site perspective  analyze and optimize your site to achieve higher rankings. explain your answer.
State, local and federal government : Who do you trust the most and least (Local, State, and Federal Government)? Why? Who do you believe is the most effective?
Accounting equation and amounts from balance sheets : Explain fully, citing specific items such as the accounting equation and amounts from the balance sheets.

Reviews

Write a Review

 

Computer Engineering Questions & Answers

  Explain networking of cis 505

Explain networking of CIS 505? 1. Network Neutrality 2. Web2.0

  Imagine that a doubly linked list "header"

Assume that a doubly linked list "header" stores the elements of a priority queue. make use of the function pop(), which deletes the element with the largest value from the list (priority queue).

  Improving the speed of e-mails

Insurance, a multi million-dollar life insurance firm, has asked you to help troubleshoot the network at its corporate headquarters.

  Multicast routing paradigm

The data-driven multicast routing paradigm works best on the local networks which have low delay and excess capacity, however the demand driven paradigm works best in the wide are environment which has limited capacity and higher delay.

  Which applications are not particularly well-suited

Which of these applications are well-suited for the minimalist Internet multicast service model? Why? Which applications are not particularly well-suited for this service model.

  How do i build a sample cmm model

What is the needs for relevant quality standards and quality management.

  Compute the greatest common divisor of two integers

Write down a recursive function that calculates the greatest common divisor of two integers using the Euclidean algorithm. Write a driver program to test your function.

  Electrical or magnetic field that the nervous system produce

activation of the brain is measured by electrophysiological techniques using an electrical or magnetic field that the nervous system produces. These types of measures include may include magneto-encephalography (MEG) or electroencephalography (EEG..

  Windows live id and skydrive account

Suppose there are 1 million books within your campus library. Approximate (to the nearest order of magnitude) how several bytes of the data there are in case all these books were stored online and accessible across the computer network.

  Which there are 200 total unites available in the system

A system has five active processes(A-E) and one type of resource, that there are 200 total unites available in the system. the current state of the system is shown in the table below.

  Write down a program that inputs a word

Write down a program that inputs a word from the keyboard and determines the length of the word. Print the word using twice the length as the field width.

  Engineer using an automated monitoring system

auto mechanic with an automatic diagnostic system.a train engineer using an automated monitoring system.

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