Monday, 6 June 2016

How to find krishnamurthy number in c

How to find Krishnamurthy number in c 
Krishnamurthy Number: It is a number which is equal to the sum of the factorials of all its digits.

For example : 145 = 1! + 4! + 5! = 1 + 24 + 120 = 145

#include<stdio.h>
#include<conio.h>
void main()
{
int j,i,x,sum=1,k=0,num,n;
clrscr();
printf("Enter a Number");
scanf("%d",&n);
num=n;
while(num>0)
 {x=num%10;
 sum=1;
for(i=x;i>=1;i--)
{
sum=sum*i;
}
k=k+sum;
num=num/10;
}
if(n==k)
 printf("%d is a Krishnamurthy Number",n);
else
 printf("%d is not a Krishnamurthy Number ", n);
getch();
}


KrishnaMurthy Number In C
krishnaMurthy Number In C



KrishnaMurthy Number In C
KrishnaMurthy Number In C



KrishnaMurthy Number In C
KrishnaMurthy Number In C
Other C Programs
Passing 2-D Array To A Function 
Pointer To An Array
Interview Questions And Answer-C


Some important question and answer

 Which of the following operators is incorrect and why? ( >=, <=, <>, ==)

<> is wrong. While this operator is effectively translated as "not equivalent to" in composing contingent articulations, it is not the correct operator to be utilized as a part of C programming. Rather, the operator != must be utilized to specify "not equivalent to" condition.

How do you declare a variable that will hold string values?

The char keywords can just hold 1 character an incentive at any given moment. By making an array of characters, you can store string values in it. Illustration: "char MyName[50]; " proclaims a string variable named MyName that can hold a greatest of 50 characters.

1 comments:

Post a Comment