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

  Provide an abstraction for a network card

Following this pattern, provide an abstraction for a network card.

  Compare the role and impact of a computing technology

information on understanding an inner workings of digital downloads and digital compression. I need to follow the outline below. I'm running out of information. I need to compare the role and impact of a computing technology on society.

  Role of antennas in transmitting radio waves

Explain the role of antennas in transmitting the radio waves. What kinds of antenna are typically used in the wireless LAN?

  Create a white paper based on knowledge

Create a white paper based on knowledge

  Do clear data from my maskedtextbox named "mtbpac"

I am using Visual Basic.NET with Microsoft Visual Studio 2005. I have a project with a User Control that I have created. I have a button that I named Clear. I require to clear the data from my maskedtextbox named "mtbPAC".

  Write the thoughts according to you

All doctor offices have not become 100 percent computerized yet. You can still see good % of offices use manual patient record files indexed by the first letter of patients' last names.

  Excel supports nesting of functions

Excel supports nesting of functions within one another. Why is that helpful ? Offer some examples of when you would and would not want to use nesting.

  Build a java program named comparefiles.java

make a java program named CompareFiles.java and enter the code to check if the files, TeamProj.txt and TeamProj2.txt, exist.

  What is the memory operations dominate execution time

What is  the memory operations dominate execution time

  Create a testrectangle class in java

An overloaded constructor that takes integer width and height arguments, uses a separate method to check whether the width and height fall within the range between 0 and 30, and throws an exception if out of range.

  Describe the function and purpose of each component

describe how the components are related to each other. For example, does the component you are describing depend on another to operate? Is it connected to the network physically or wirelessly.

  Give an example of a useful class

Visual Basic.NET allows you to make your own classes. Provide an example of a useful class you could create. What methods and properties would you include? Show an example of a method declaration for your class.

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