Question

describe the output that will be generated by this basic program Let x=0 FOR i =...

describe the output that will be generated by this basic program
Let x=0
FOR i = 0 to 4
FOR j = 0 to i-1
LET k = (i+j-1)
IF (k MOD 2=0) THEN
      LET x= x+k
    ELSE IF(k MOD 3 = 0) THEN
    LET x=x+k-2
END IF
PRINT X
NEXT J
NEXT I
END

Homework Answers

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
Give the output of the program using Call-By-Reference: int i, a[3]; void f (int x, int...
Give the output of the program using Call-By-Reference: int i, a[3]; void f (int x, int y){ x = (x*y) mod 3; y = y – x; } main(){ i = 0; a[0] = 1; a[1] = 2; a[2] = 0; f(i, a[i]); print(“%d %d %d %d\n”, i, a[0], a[1], a[2]); f(a[i], a[i]); print(“%d %d %d\n”, a[0], a[1], a[2]); }
The C++ program steps through the array x[]. For each i, if x[i] < x[i+1], i...
The C++ program steps through the array x[]. For each i, if x[i] < x[i+1], i is saved in the array ascend[], in order. Compile and run the program; it should print 0 4 5. In this exercise, you’ll try to translate the C++ program to MIPS. Some of the more tedious parts are already given in Assignment3.F19.s. You won’t have to write the data allocation sections, some of the initializations, and the output loop at the end. So the...
convert the while loop into for loop x = int(input('Enter initial value: ')) count = 0...
convert the while loop into for loop x = int(input('Enter initial value: ')) count = 0 if(x<1): print('Error') exit() print('Initial value is: ',x,' ',end='') while(x!=1): if(x%2==0): x=x/2 else: x=3*x+1 count+=1 if(x!=1): rint('Next value is: ',int(x),' ',end='') else: print('Final value ',int(x),', ',end='') print('number of operations performed ',int(count),' ',end='') break
This program will output a right triangle based on user specified height triangle_height and symbol triangle_char....
This program will output a right triangle based on user specified height triangle_height and symbol triangle_char. (1) The given program outputs a fixed-height triangle using a * character. Modify the given program to output a right triangle that instead uses the user-specified triangle_char character. (1 pt) (2) Modify the program to use a loop to output a right triangle of height triangle_height. The first line will have one user-specified character, such as % or *. Each subsequent line will have...
Implement a singly linked list having all unique elements with the following operations.I 0 x –...
Implement a singly linked list having all unique elements with the following operations.I 0 x – Inserts element x at the end. I 1 y x – If the element y exists, then insert element x after the element y, else insert element y before the existing element x. Assuming either the element x or the element y exists. I 2 z y x – Inserts element x in the middle of the elements z and y. The element z...
What output will the following Python program produce? n = 10 while n != 1: print...
What output will the following Python program produce? n = 10 while n != 1: print (n,) if n % 2 == 0: # n is even n = n // 2 else: # n is odd n = n * 3 + 1
Let S be the surface z = m + x^2 + y^2 above the rectangle [0,...
Let S be the surface z = m + x^2 + y^2 above the rectangle [0, 3] x [0, 4]. Compute the flux of the vector field F(x, y, z) = 4 x i + 2 y j + 4 z k across S. Your answer should be an exact expression. Please help me I need this ASAP
Let F=(x2+y+2+z2)i+(ex2+y2)j+(3+x)k. Let a>0 and let S be part of the spherical surface x2+y2+z2=2az+15a2 that is...
Let F=(x2+y+2+z2)i+(ex2+y2)j+(3+x)k. Let a>0 and let S be part of the spherical surface x2+y2+z2=2az+15a2 that is above the x-y plane. Find the flux of F outward across S.
2. Let f(x) = sin(2x) and x0 = 0. (A) Calculate the Taylor approximation T3(x) (B)....
2. Let f(x) = sin(2x) and x0 = 0. (A) Calculate the Taylor approximation T3(x) (B). Use the Taylor theorem to show that |sin(2x) − T3(x)| ≤ (2/3)(x − x0)^(4). (C). Write a Matlab program to compute the errors for x = 1/2^(k) for k = 1, 2, 3, 4, 5, 6, and verify that |sin(2x) − T3(x)| = O(|x − x0|^(4)).
Let F(x, y, z)  =  (3x2 ln(6y2 + 2) + 8z3) i  +  (  12yx3 6y2...
Let F(x, y, z)  =  (3x2 ln(6y2 + 2) + 8z3) i  +  (  12yx3 6y2 + 2 + 7z) j  +  (24xz2 + 7y − 10π sin πz) k and let  r(t)  =  (t3 + 1) i  +  (t2 + 2) j  +  t3 k ,  0  ≤  t  ≤  1. Evaluate   C ∫ C F · dr .