Plataforma: URI
Problema: 1153
Enunciado:
Ler um valor N. Calcular e escrever seu respectivo fatorial. Fatorial de N = N * (N-1) * (N-2) * (N-3) * ... * 1.
Linguagem: C
Solução:
#include<stdio.h> int main(){ int n, i; long int resposta; scanf("%i",&n); i=n; resposta=1; while (i>1) { resposta = resposta * i; i--; } printf("%li\n",resposta); return 0; }
Nenhum comentário:
Postar um comentário