This Post Contains A C Program To Find A Factorial Of A Number With
Correct Source Code & Output. This Program Is Written, Compiled
& Executed At TurboC/C++3.0 Compiler & Will Help You To
Understand The Concept Of 'For-Loop' From C Language. It Is A
Well-Structured Program With Proper Comments Which Provides Step-By-Step
Description Of Various Features Of The Language In A Simple &
Easy-To-Understand Way.
# Note : You Can Simply Copy-Paste The Following Program Or Code Into Compiler For Direct Result.
C Program To Find A Factorial Of A Number.
/* Declaration Of Header Files */
# include < stdio.h >
# include < conio.h >
/* Start Of Main Program */
void main()
{
/* Declaration Of Variables */
int i, Num = 0, f;
clrscr();
/* Asking For The Input From User */
printf ( " \n Enter Any Number : " );
scanf ( " %d ", &Num );
/* Source Code For Computing Factorial Of A Number */
f = 1;
for ( i = Num; i > 0; i-- )
{
f = f * i;
}
printf( " \n Factorial Of No. %d : %d ", Num, f );
getch();
}
/* End Of Main Program */
Output :
Enter Any Number : 6!
Factorial Of No. 6 : 720
This blog provides an overview about basic structure of C/C++ programs and their execution, which makes it an ideal guidance source for Programmers and Students. Based on practical approach this blog features a wide range of programs, which enables the learner to understand the techniques such as: Simple Programs, Loops, Arrays, Functions, Objects, Operator Overloading, Polymorphism, Files, Graphics, Strings, Sorting and Searching Methods, Stack, Queues, Link-Lists, Trees and Mini-Projects.
Subscribe to:
Post Comments (Atom)
Blog Archive
-
▼
2013
(77)
-
▼
March
(12)
- C++ Program To Find Number Of Times The Given Numb...
- C++ Program For Calculating Cricket Team Average.
- C Program For Printing ASCII Values On Screen/Cons...
- C Program For Printing Triangle Of Numbers.
- C Program For Conversion Of Celsius To Fahrenheit.
- C Program For Conversion Of Fahrenheit To Celsius.
- C Program To Find Number Of Odd & Even Numbers.
- C Program To Find Prime Factors Of A Number.
- C Program To Find A Factorial Of A Number.
- Mini Project :~ C Program For Various Operations O...
- C++ Program For Converting A User Entered Number I...
- C++ Program To Print A Number In An Ordered Form.
-
▼
March
(12)
No comments:
Post a Comment