Write a program to print a factorial table.
#include <stdio.h>
#include <conio.h>
void main ( )
{
long num = 1, fact = 1;
clrscr ( );
printf ("\n\t\t FACTORIAL TABLE\n\n");
printf ("\n\t NUMBER \t\t FACTORIAL");
printf ("\n\t ==================================");
while ( num <= 10 )
{
fact = fact * num;
printf ("\n\t\t %ld \t\t %ld",num, fact);
num ++;
}
printf ("\n\t ===================================");
getch ( );
}
No comments:
Post a Comment