# Special Number C Program

## 2 Ways To Check Special Number in C Programming

Here we have listed How To Check Special Number in C Programming Language. It is important to know **Factorial Program in C** before you proceed with this code. Also Check Special Numbers From 1 Till N in C Code. This Program For Krishna Murthy Number makes use of While Loop which helps in Iterative Process.

Special Number is alternatively known as Krishna Murthy’s Number. Prof. Krishna Murthy is an IIT Graduate and has Formulated the Special Number Concept.

#### What is a Special Number?

An Integer is said to be a Special Number if the Sum of the Factorial of Every Digit is equal to the Number itself.

#### Example

**145 = 1! + 4! + 5! 40585 = 4! + 0! + 5! + 8! + 5!**

**Also Read: C Program To Check Armstrong Numbers**

**Note:** This C Program To Find Special Integers or Ramanujan’s Number is developed in Linux Ubuntu Operating System and compiled with GCC Compiler.

#### Code To Check Special Number in C Program with While Loop

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | #include<stdio.h> int isSpecial(int arg) { int sum = 0, temp, count, fact; temp = arg; while(temp != 0) { fact = 1; for(count = 1; count <= temp%10; count++) { fact = fact * count; } sum = sum + fact; temp = temp/10; } if (sum == arg) { return 1; } else { return 0; } } int main() { int num, result; printf("\nEnter a Number:\t"); scanf("%d", &num); result = isSpecial(num); if(result == 1) { printf("\n%d is a Special Number\n\n", num); } else { printf("\n%d is Not a Special Number\n\n", num); } return 0; } |

If the Function isSpecial() returns a value 1, then the Entered Number is a Special Integer or the Krishna Murthy Number. If the Function returns 0, then it is not a Special Integer.

#### Output

#### C Program Code To Check Special Number From 1 To N

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | #include<stdio.h> int isSpecial(int arg) { int sum = 0, temp, count, fact; temp = arg; while(temp != 0) { fact = 1; for(count = 1; count <= temp%10; count++) { fact = fact * count; } sum = sum + fact; temp = temp/10; } if (sum == arg) { return 1; } else { return 0; } } void main() { int limit, count; printf("\nEnter The Limit:\t"); scanf("%d", &limit); printf("\nSpecial Numbers Till %d:\n\n",limit); for(count = 1; count <= limit; count++) { if(isSpecial(count) == 1 ) { printf("%d\t",count); } } printf("\n\n"); } |

#### Output

If you get any Compilation Errors or if you have any doubts about this C Program To Find Special Number or Krishna Murthy Number, do mention about it in the Comment Section.

This is amazing. Special number seems to be a combination of Armstrong Number and Factorial concepts in C Programming.

i wanna c code of ->special number which means the sum of the sum of its digits and the product of its digit is equal to the number itself .example 19 is a special number as 1+9=10 and 1*9=9 so 10+9=19.

so i want c program to find these numbers between limits.