PROGRAM FactorPrimo(input,output);
VAR
numero : integer;
factor : integer;
resto : integer;
primo : integer;
multiplicidad : boolean;
BEGIN
write('Ingrese numero: ');
readln(numero);
factor := 2;
primo := 0;
multiplicidad := false;
IF numero > 1 THEN
BEGIN
REPEAT
BEGIN
resto := numero MOD factor;
IF resto = 0 THEN
BEGIN
numero := numero DIV factor;
primo := primo + 1;
multiplicidad := true;
END
ELSE IF multiplicidad = true THEN
IF primo > 1 THEN
writeln(factor,'^',primo);
multiplicidad := false;
ELSE
writeln(factor);
multiplicidad := false;
ELSE
factor := factor + 1;
primo := 0;
END;
UNTIL numero = 1
writeln(factor);
END
ELSE
write('Debe ingresar un numero mayor a 1');
END.
Hello sorry for bothering you, I previusly made this code for java and now was traying to translate it to pascal, but i cant figured it out why it says i have a syntax error, ";" expected but "ELSE" found in line (30,5). Can you help me please?
elsewithbeginandend- nepb