Algorithms pseint

Classified in Other subjects

Written at on English with a size of 1.55 KB.

 
Ejercicio3guia Process
/ / Read 20 numbers and print how many are +, - and how many are zeros
Dimension number [20] / / vector
/ / Variables
positive <- 0;
negative <- 0;
zeros <- 0;
sum <- 0;
rest <- 0;
x <- 1
while (x <= 20) Make
write "Enter Number:";
read number [x]
x <- x +1
FinMientras
write ""
write "Positive numbers ** **";
positive <- number [1];
For j <- 1 to 20 with step 1 Make
if (number [j]> 0) Then
sum <- sum +1;
FinSi
finpara
write "Number of positive numbers:", sum;
write ""
write "** ** Negative Numbers";
positive <- number [1];
For j <- 1 to 20 with step 1 Make
if (number [j] <0) Then
rest <- subtract +1;
FinSi
finpara
write "Number of negative numbers:", subtraction;
write ""
write "** ** Zeros";
positive <- number [1];
For j <- 1 to 20 with step 1 Make
if (number [j] = 0) Then
zeros <- zero +1;
FinSi
finpara
write "number of zeros", zero;
FinProceso

Entradas relacionadas: