C-Programming:-
In this tutorial yon will learn:-
Write a program to check whether a number spy or not.
#include<stdio.h>
#include<conio.h>
void main()
{
int n,sum=0,product=1,r;
printf("Enter any number");
scanf("%d",&n);
while(n>0)
{
r=n%10;
sum=sum+r;
product=product*r;
n=n/10;
}
if(sum=product)
{
printf("number is spy");
}
else
{
printf("number is not spy");
}
getch();
}
0 comments:
Post a Comment
If you have any doubt, please let me know