Question

Given 3 numbers T, r and s, where r != s and r > 1 &...

Given 3 numbers T, r and s, where r != s and r > 1 & s > 1. Print a list of numbers from 1 to T where numbers divisible by r whose decimal representation does not contain the digit r should be replaced by the number 555 and any number (int) divisible by s whose decimal representation does not contain the number s should be replaced by the number 333. Numbers for which both of the past arguments are true should be replaced by the number 444.

Input

7 2 3

Expected Output

1 2 3 555 5 444 7

Please write the answer in pseudocode

Homework Answers

Answer #1

1: Create function ispresent(int a, int b) to check if b is present in a.

1.1: while loop till the number is not equal to 0

1.1.1: extract the last digit and check if it is equal to b. If yes return 1.

1.1.2: update the number by dividing it by 10

1.2: end of loop

1.3: return 0 meaning that b is not present in a.

2: Input T, r, and s. Make an array putting numbers 1 to T in it.

3: for loop i=0 to 6

3.1: if array element at i is divisible by r*s and both ispresent(array[i],r) and ispresent(array[i],s)  returns 0 then array[i]=444

3.2: else if array[i] is divisible by r and ispresent(array[i],r) returns 0 then array[i] will be 555.

3.3: else if array[i] is divisible by s and ispresent(array[i],s) returns 0 then array[i] will be 333.

3.4: end loop

4: Print the array.

5: Stop

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
PYTHON 3 Write a program that prints the count of all prime numbers between A and...
PYTHON 3 Write a program that prints the count of all prime numbers between A and B (inclusive), where A and B are defined as follows: A = 21212 B = A + 5000 Just a recap on prime numbers: A prime number is any number, greater or equal to 2, that is divisible ONLY by 1 and itself. Here are the first 10 prime numbers: 2, 5, 7, 11, 13, 17, 19, 23, and 29. Rules: You should first...
Write a program in python that prints the count of all prime numbers between A and...
Write a program in python that prints the count of all prime numbers between A and B (inclusive), where A and B are defined as follows: A = The 5 digit unique number you had picked at the beginning of the semester B = A + 5000 Just a recap on prime numbers: A prime number is any number, greater or equal to 2, that is divisible ONLY by 1 and itself. Here are the first 10 prime numbers: 2,...
Consider the parameterized motion given by r(t)=3t^2i-2t^2j+(6-t^3)k. Where is the object at time t=1? What is...
Consider the parameterized motion given by r(t)=3t^2i-2t^2j+(6-t^3)k. Where is the object at time t=1? What is the velocity at t=1? What is the speed at t=1? How far does the object move from 0≤t≤1? Round your answer to 2 decimal places. * r, i, j, and k should all have vector arrows above them
Write the curve given by r(t)=((3/2)t)i+(t^3/2)j as a function r(s) parameterized by the arc length s...
Write the curve given by r(t)=((3/2)t)i+(t^3/2)j as a function r(s) parameterized by the arc length s from the point where t=0. Write your answer using standard unit vector notation.
IN C++ AS SIMPLE AS POSSIBLE ______ Re-write the given function, printSeriesSquareFifth,  to use a while loop...
IN C++ AS SIMPLE AS POSSIBLE ______ Re-write the given function, printSeriesSquareFifth,  to use a while loop (instead of for). • The function takes a single integer n as a parameter • The function prints a series between 1 and that parameter, and also prints its result • The result is calculated by summing the numbers between 1 and n (inclusive). If a number is divisible by 5, its square gets added to the result instead. • The function does not...
Determine the interval(s) where r(t)=< t-1/((t^2) -1), 2e^3t , In(t+5) > is continuous. And Both r1(t)...
Determine the interval(s) where r(t)=< t-1/((t^2) -1), 2e^3t , In(t+5) > is continuous. And Both r1(t) = < t2, t4 > and  r2(t) = < t4, t8 > map out the same half parabolic graph. Notice that both r1(1) = < 1, 1 > and  r2(1) = < 1, 1 >. However, r'1(1) = < 2, 4 > and  r'2(1) = < 4, 8 >. Explain why the difference is logical and quantify the difference at t=1. Determine the interval(s) where r(t)=<t −...
Here are SQL declarations for three tables R, S, and T: CREATE TABLE R(e INT PRIMARY...
Here are SQL declarations for three tables R, S, and T: CREATE TABLE R(e INT PRIMARY KEY, f INT); CREATE TABLE S(c INT PRIMARY KEY, d INT REFERENCES R(e) ON DELETE CASCADE); CREATE TABLE T(a INT PRIMARY KEY, b INT REFERENCES S(c) ON DELETE CASCADE); Suppose R(e,f) contains tuples (1,0), (2,4), (3,5), (4,3), and (5,7). Suppose S(c,d) contains tuples (1,5), (2,2), (3,3), (4,5), and (5,4). Suppose T(a,b) contains tuples (0,2), (1,2), (2,3), (3,4), and (4,4). As a result of the...
C++ PROGRAM. (C++ INTRO QUESTION) Write a program that prints the count of all prime numbers...
C++ PROGRAM. (C++ INTRO QUESTION) Write a program that prints the count of all prime numbers between A and B (inclusive), where A and B are defined as follows: A = 55000 B = A + 5000 Just a recap on prime numbers: A prime number is any number, greater or equal to 2, that is divisible ONLY by 1 and itself. Here are the first 10 prime numbers: 2, 5, 7, 11, 13, 17, 19, 23, and 29. Rules:...
1) Write a java programming using a while loop where you will add numbers and when...
1) Write a java programming using a while loop where you will add numbers and when you press number 0 it will add all your numbers and display the results. Use Scanner object. Steps: 1) Declare variables integer called sum which is equal to zero   2) Declare Scanner object   3) Declare while condition where is true   4) Inside of that condition prompt the user to enter the numbers   5) Declare variable integer called number and input the number statement   6)...
is true or false i. For all linear transformations S, T : R 3 → R...
is true or false i. For all linear transformations S, T : R 3 → R 3 , rank(S)+rank(T) = rank(S+T) ii. Any linear transformation T : R 11 → R 4 has nullity at most 7 iii. For any linear transformation T : R 3 → R 3 and constant c, nullity(cT) = c nullity(T).
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT