" Learn Free Coding contains well written, well thought, well explained and easily Understandable computer science articles, Learn C, Java, Python, HTML, C# & everything else. "

How to Find out the FACTORIAL of a number In 'C' Language ?

MOST EASY AND SELF-EXPLANATORY   WAY ,,,[   बिलकुल  आसान  तरीका  ] 


Connect With Me On Facebook [click_here]


Just think And move Forward...Programming is not very tough ,to write code just think as commonly as you should do in real world...and proceed to write in virtual world.

➤Let us move To the CODING...by simply seeing an example.

    As factorial means , let us say we have to find out the factorial of  " 9 " ?
    
   solution:     fact = 9(9-1)(9-2)(9-3)(9-4)(9-5)(9-6)(9-6)(9-7)(9-8)(9-9)
                     
                    ⇛  If we write (9-9) ,then the something is multiplied by Zero is " 0 ". 
                         so we cannot write this term (9-9)  ,now calculate and proceed i.e,
                      .
                    .   .  fact =  9(9-1)(9-2)(9-3)(9-4)(9-5)(9-6)(9-6)(9-7)(9-8)  
                                  
                                  = 9x8x7x6x5x4x3x2x1

                                  = 362880  , it is the answer.               
     
    ➽ So , In Real World We Calculate Like This....Now Proceed To Write This In Virtual World.


                                                         ⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬⏬




#include<stdio.h>
#include<conio.h>

void main()
{
   clrscr();
        float n,fact=1;
         printf("Enter The Number: ");
        scanf("%f",&n);
while (n>1)
{
   fact=fact*(n);
      n=(n-1);
}
    printf("The Factorial Of The Number Is = %f",fact);

   getch();

}

                                                               Like My Meme Page [click_here]

                                                                                  THANKS


                                                          
                         


How to Find out the FACTORIAL of a number In 'C' Language ? How to Find out the FACTORIAL of a number In 'C' Language ? Reviewed by Shaishav Anand on February 08, 2019 Rating: 5

2 comments:

Powered by Blogger.