// bai2.cpp : Defines the entry point for the console application.
// code Dung NV
#include"stdafx.h"
#include<conio.h>
#include<stdio.h>
unsignedlong giaithua(intn)
{
inti;
unsignedlong gt=1;
if(n==0 || n==1) return 1;
for(i=2;i<=n;i++) gt=gt*i;
returngt;
}
int_tmain(int argc, _TCHAR* argv[])
{
intn;
printf("\nNhap N= ");
scanf("%d",&n);
printf("\nGiai thua %3d! = %lu",n,giaithua(n));
getch();
return0;
}
No comments:
Post a Comment