c program to check strong number or not for a given number

List of programs below:C program to check strong number or not using functions,C program to check strong number or not using for a given number using for loop, C program to check strong number or not using while loop, c program to find strong numbers below n, c program to find strong numbers between two  numbers.

A strong number is a number whose sum of factorials of digits is equal to same number.
example:
145= 1! + 4! + 5! = 1 + 24 + 120 = 145

program logic for c program to find a given number is strong number or not:
Input a number say n,save it in a variable now until n is greater than zero for each digit calculate factorial and save in str variable at end of loop if number ( n ) is equal to number in str variable then the number is strong number else not a strong number. c program to check strong number or not using functions, for, while loop

write a c program to check strong number or not using functions

write a c program to check strong number or not using functions

#include <stdio.h>
#include <conio.h>
main()
{
int no;
clrscr();
printf(“OUTPUT: c program to find a given number is strong or not using functions \n \n”);
printf(“enter no.”);
scanf(%d \n”,&no);
void strong(no);
}

void  strong( int n)
{
int temp ,n,str,r;
temp =n;
str=0
while(n>0)
{
r=n%10;
str=str*factorial(r);
n=n/10;
}
if( temp==str)
printf(“%d is a strong no. “, temp );
else
printf(“%d is not a strong no. “,temp);
getch();
}

int factorial(int a)
{
int f,g;
f=1;
for(g=a;g>0;g–)
f=f*g;
return(f);
} OUTPUT : c program to check strong number or not using functions

write a c program to find a number is strong or not using for loop

write a c program to check strong number or not using for loop

#include <stdio.h>
#include <conio.h>
main()
{
int c ,n, s,r;
clrscr();
printf(“OUTPUT: c program to check a given number is strong or not using for loop \n”);
printf(“enter no. \n”);
scanf(%d\n”,&n);
c =n;
s=0
for(;n>0;;)
{
r=n%10;
s=s*factorial(r);
n=n/10
}
if(c==s)
printf(“yes, this number is a strong number “);
else
printf(” no, this number is not a strong number” );
getch();
}

int factorial(int a)
{
int f,g;
f=1;
for(g=a;g>0;g–)
f=f*g;
return(f);
} OUTPUT : c program to check strong number or not using for loop

write a c program to check strong number or not using while loop

write a C program to check strong number or not using while loop

#include <stdio.h>
#include <conio.h>
main()
{
int c ,no,str,r;
clrscr();
printf(“…c program to find a given number is strong or not using while loop… \n”);
printf(“enter any no.\n”);
scanf(%d\n”,&no);
c =no;
str=0
while(no>0)
{
r=no%10;
str=str*fact(r);
no=no/10;
}
if( c==str)
printf(“yes, this number is a strong number “);
else
printf(“no, this number is not a strong number “);
getch();
}

int fact(int a)
{
int f,g;
f=1;
for(g=a;g>0;g–)
f=f*g;
return(f);
} OUTPUT : c program to check strong number or not using for loop

write a c program to find strong numbers below n / between 1 and n

write a C program to find strong numbers below n

#include <stdio.h>
#include <conio.h>
main()
{
int c ,n,str,r;
int flag=0;
clrscr();
printf(“… c program to find strong numbers below n … \n”);
printf(“enter n value \n”);
scanf(%d\n”,&n);
printf(“Strong Numbers are :”);
for(int i=1; i<n; i++)
{
c =i;
str=0
while(i>0)
{
r=i%10;
str=str*fact(r);
i=i/10;
}
if( c==str)
{
flag=1;
printf(“\n%s”, str);
}
if(flag==o)
{
printf(“no, strong numbers in this range”, str);
}
}
getch();
}

int fact(int a)
{
int f,g;
f=1;
for(g=a;g>0;g–)
f=f*g;
return(f);
}

write a c program to find strong numbers between two numbers

write a c program to find strong numbers between two numbers

#include <stdio.h>
#include <conio.h>
main()
{
int c ,n,m,str,r,temp;
int flag=0;
clrscr();
printf(“c program to find strong numbers between two numbers \n”);
printf(“enter first number \n”);
scanf(%d\n”,&n);
printf(“enter second number \n”);
scanf(%d\n”,&m);
printf(“Strong Numbers are :”);
//making n smaller number
if(n>m)
{
temp=n;
n=m;
m=temp;
}
//finding strong numbers n and m;
for(int i=n; i<m; i++)
{
c =i;
str=0
while(i>0)
{
r=i%10;
str=str*fact(r);
i=i/10;
}
if( c==str)
{
flag=1;
printf(“\n%s”, str);
}
if(flag==o)
{
printf(“no, strong numbers in this range”, str);
}
}
getch();
}

int fact(int a)
{
int f,g;
f=1;
for(g=a;g>0;g–)
f=f*g;
return(f);
}