0
I’m new to programming and I need help in a college exercise, I need an algorithm in Visualg that shows the prime numbers between an n1 number and an N2 number, using a repetition structure, where n1 and N2 are informed by the user. The algorithm I made is this (but I don’t know what’s left to work):
Var
// Seção de Declarações das variáveis 
c, i, n1, n2, p: inteiro
Inicio
// Seção de Comandos, procedimento, funções, operadores, etc... 
escreva ("Digite um número incial: ")
leia(n1)
escreva ("Digite um número final: ")
leia (n2)
para c de n1 ate n2 faca
     p<-0
     para i de n1 ate c faca
          se(cmod i=0) entao
                  p<-p+1
          fimse
     fimpara
     se (p=2) entao
        escreva (c)
     fimse
fimpara
Fimalgoritmo
I tested it here and it worked, that’s what I needed, I wasn’t able to find the error, I just altered it a little by putting some spaces to help in the display and understanding when the algorithm runs. Thanks for the help
– Breno Leonetti