Showing posts with label C Program. Show all posts
Showing posts with label C Program. Show all posts

Friday, May 7, 2021

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");

else

printf("Not A Krishnmurti Number");

getch();  /* To Hold the Output Screen */

}


KAiSH Computer Institute, Lucknow: Join One Course, Get Multiple Certificates – A Golden Opportunity in Uttar Pradesh

KAiSH Computer Institute, Lucknow: Join One Course, Get Multiple Certificates – A Golden Opportunity in Uttar Pradesh If you...