Passaggio dei parametri:
program POTENZA;{calcolo x^N}
var x:real;N:integer;
function ELEVA:real;
begin {ELEVA}
case N of
0:R:=1;
1:R:=x;
else begin
R:=1; for 1 :=1 to N do R:=R*x;
end;
end {case}
ELEVA :=R;
end;
begin{main}
write('digita i valori di base ed esponente');
readln(x,N);
writeln('risultato =' ,ELEVA:3:2);
end.
sabato, febbraio 17, 2007
Iscriviti a:
Commenti sul post (Atom)
Nessun commento:
Posta un commento