Lista 03a - DCC/UFMG
Lista 03a - DCC/UFMG
Lista 03a - DCC/UFMG
- No tags were found...
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
36) Escreva um algoritmo em PORTUGOL para calcular o fatorial do número N, cujovalor é obtido através do usuário pelo teclado.algoritmo L3P036;varinteiro: N, FAT, C;inícioFAT ← 1;leia(N);para C de 2 até N façaFAT ← FAT * C;fim-paraimprima("O valor do fatorial de N é: ",FAT);fimprogram l3p036;varN, C: integer;FAT: real;beginwrite('Digite um numero: ');readLn(N);FAT := 1;for C := 2 to N doFAT := FAT * C;writeLn('O valor do fatorial de N eh: ',FAT:2:0 );end.% N, C: integer;% FAT: real;N = input('Digite um numero: ');FAT = 1;for C = 2 : NFAT = FAT * C;endfprintf(1,'O valor do fatorial de N eh: %d\n',FAT);<strong>UFMG</strong> – ICEx – <strong>DCC</strong> – Programação de Computadores – 2º. Sem 2005 – David Menoti 36