## Find a Number is Strong or not in C language With Example

C Language program to find a Number is strong or not. It is a simple source code that provides the output of an actual Strong number. Take care of a questions for your interviews or students exam. This is a totally free of cost code.

Find a Number is Strong or not in C language With Example
Number is strong in C program means it calculates the factorial value for the entire number. If the total of a factorial value is the same as given number, then this number is said to be a strong number. For example 125(1!+2!+5!=1+2+120=123) is weak number. Then the strong number is 145.

Q: Write a C program to check whether the given number is strong or not.

//Header file section
#include <stdio.h>
#include <conio.h>
#include <math.h>

void main()
{
//Program variables
int value,num,temp=1,ans=0,cn,num1;
clrscr(); //Function to clear previous output

printf("Enter the value : "); //Display function
scanf("%d",&num); //Getting input function
value=num;

//calculating number is strong or not
while(num>0//unconditional statement
{
temp=1;
num1=num%10;
for(cn=num1;cn>1;cn--)/ /Looping statement
{
temp=temp*cn;

}
num/=10;
ans+=temp;
}
printf("ans = %d",ans);
if(value==ans) //Conditional statement
printf("Number is strong number");

getch();
}

#### Post a Comment

Note: only a member of this blog may post a comment.

## Labels

Designed By Blogger Templates