How to represent algorithm in C for Pseudocode?

2

I have the following code:

setlocale(LC_ALL,"portuguese");

int numeros[5];
int media;

for(int i = 0; i < 5; i++) {
    printf("Digite um número : ");
    scanf("%d", &numeros[i]);
}

media = numeros[0] + numeros[1] + numeros[2] + numeros[3] + numeros[4];

printf("\nMedia : %d \n\n", media);
printf("Número 1 : %d \n", numeros[0]);
printf("Número 2 : %d \n", numeros[1]);
printf("Número 3 : %d \n", numeros[2]);
printf("Número 4 : %d \n", numeros[3]);
printf("Número 5 : %d \n", numeros[4]);

I need to pass this code to Pseudocode, but I can not remember how I can correctly represent the for part.

    
asked by anonymous 20.05.2017 / 17:21

1 answer

4

First, I want to make it clear that Pseudocode does not have a default template, and is simply meant to represent a form code that people who see it can easily understand. So if you do not like the model I made here, I believe that it does not deserve -1 because as I said above, it has no default, in case you want to add something more, please let me know.

InicioAlgoritmo

Variaveis

numero : vetor[1..5] de inteiro
media,i : inteiro

Inicio

para i de 1 ate 5 faca
escreval ("Digite um número");
leia(numeros[i]);
fimpara

media <- (numeros[0]+numeros[1]+numeros[2]+numeros[3]+numeros[4]) / 5;

para i de 1 ate 5 faca
escreval("Número : %d %d, i+1, numeros[i]);
fimpara

FimAlgoritmo
    
20.05.2017 / 18:01