You write this code into any c compiler and get factorial of given number by run this code.
C Program Code
//factorial of a number
#include "stdio.h"
#include "conio.h"
void main()
{
int fact=1,n;
clrscr();
printf("enter any number");
scanf("%d",&n);
while(n>0)
{
fact=fact*n;
n--;
}
printf("\n factorial of given number= %d",fact);
getch();
}
Input/Output
enter any number 4
factorial of given number= 24
Factorial of 4 = 4*3*2*1 =24
Showing posts with label calculate factorial. Show all posts
Showing posts with label calculate factorial. Show all posts
Wednesday, November 10, 2010
Subscribe to:
Posts (Atom)
Popular Posts
- What is Dofollow and Nofollow Links?
- PL/SQL program to generate Fibonacci series
- How to Format a Date in JavaScript
- Java Function Code to create Reverse Linked List of Singly Linked List (In memory pointer changes)
- Exception Handling Program in PL/SQL Oracle
- How to List S3 Buckets and Objects Using AWS CLI
- C Program For Fibonacci Series
- How to Use Java Streams for Data Processing with Example
- C Program For Floyd's Triangle
- PL/SQL Example to find average of three numbers