Compile the Output of the Code and Execute the Output



Compile the Output of the Code and Execute the Output

Consider the following program written in a toy programming language. (The meaning of the various commands in this language should be obvious, but if you're confused, click here for the language description).

array A = 1, 2, 7, -4, -3, 5, -1, 4, 6
read N
set I = 0
set J = 0
while I < N
if A[I] < 0
set J = J + 1
endif
set I = I + 1
endwhile
write J
The first line of the program declares and initializes an array with 9 elements as shown. The second line of the program reads an integer from the input and stores it in N. The rest of the program does some computation and the last line of the program prints the value of the variable J to the output.

If the number 5 is provided as input to this program, what will the output of this program be?

Asked by: Priya on Dec 3, 2018.EDIT

Be the first to answer this Question !

Your Answer :

Name *:

Email *: (Required but will not be displayed)

» Your answers will be displayed only after manual approval.

Related Questions


No related questions found for this page.

Sponsored Links


Current Affairs

Quick Links