Posts

Showing posts with the label Factorial Program

Write a C Program to Check the entered number is Krishnamurti Number or not?

Hi Students,  Namskar, Sabse pahle is Program mein hm aapko bta de ki Krishnamurti Number Kya Hota Hai...Fir Program Par chalte hai.. Krishnamurti Number us number ko kahte hai, jisme di gyi sankhya ke pratyek digit ka Factorial aapas me add krne par fir se vhi Sankhya prapt ho jaye ... For Example: 145 1!+4!+5! = 145 #include<stdio.h> #include<conio.h> void main() { int n,org=0,new=0,fact,i,digit; clrscr();  /* To Clear the Previous Output on Screen */ printf("enter the number");      scanf("%d",&n);                           org=n;                                          while(n>0)                                     {   digit=n%10;                                   fact=1;                                           for(i=1;i<=digit;i++)                         {     fact=fact*i;                                        }   new=new+fact;          n=n/10;                      } if(n==new)  printf("Entered Number is Krishnmurti Number"