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

  Consider which properties could be verified

define that some properties that can only be validated originally can be approximately transformed to properties that could be verified.

  Find out the average amount of money

Find out the average amount of money that it has taken to do maintenance on each different model of jumbo jet (defined to be any airplane model whose capacity is at least 150).

  Explain the number of nodes and workstation types

The office has four separate rooms, each one with its own set up of dental equipment and 1 X-ray room.

  Program to calculate value of d=b squared-4ac

Provided that a method takes three parameters a, b, c, of type double, state some code, to be involved as a part of the method, which calculates whether the value of "b squared" – 4ac is negative. If negative, code prints out the message "no real sol..

  The difference between a worm and a trojan horse

What do you tell him is the difference between a worm and a Trojan horse. List at least six reasons you can give John for preventing viruses and other malware.

  Create program that displays a student id number

Write a program that shows a student ID number and asks the user to enter a numeric test score for the student. Create a ScoreException class.

  How to create two sql scripts

Then make two SQL scripts. The first should be a DDL code for your tables, data, and PL/SQL package. The second should be an SQL script to show the testing of the execution of the package.

  Ethical dialectical process of thinking state

Ethical Dialectical Process of Thinking state

  Describe the program development cycle

Describe the importance of using a structured, modular approach when creating program requirements, design, and code.

  Pros and cons of different security techniques

Why is it important for an organization to follow the standard systems acquisition method?pros and cons of different security techniques.

  How to use the same naming conventions

how to use the same naming conventions and that their programs work together even though they are created independently.

  Verilog system

Develop a verilog system which utilizes a block code for the error management. The system must accept a 15-word block of 8-bit data words one word at a time.

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