PROBLEMA Sia data la seguente procedura: procedure CALCOLO1; variables A, M, I integer; variables D string; read D; A = 0; M = 0; for I from 1 to len(D) step 1 do; if D(L,I) == 'a' then A = A + 1; else if D(I,I) == 'm' then M = M + 1; endif; endif; endfor; write A, M; endprocedure; Sapendo che il valore di input per la variabile D è la stringa 'Nel mezzo del cammin di nostra vita' calcolare i valori di output di A ed M e scriverli nella tabella sottostante.

Computers

Question
PROBLEMA
Sia data la seguente procedura:
procedure CALCOLO1;
variables A, M, I integer;
variables D string;
read D;
A = 0;
M = 0;
for I from 1 to len(D) step 1 do;
if D(L,I) == 'a'
then A = A + 1;
else if D(I,I) == 'm' then M = M + 1; endif;
endif;
endfor;
write A, M;
endprocedure;
Sapendo che il valore di input per la variabile D
è la stringa 'Nel mezzo del cammin di nostra vita'
calcolare i valori di output di A ed M e scriverli nella tabella sottostante.
Answer

A = 5, M = 2

Download to view full explanation
The procedure CALCOLO1 reads in a string, D, and then counts the number of 'a' and 'm' characters in the...
Solve any homework question FREE with our app, NO PAYMENT required!