Write a program in C++ usung while loop to enter a number and print whether the number is a SPY number or not.
(C++ program needed)
Answers
Answered by
1
Answer:
#include <iostream>
using namespace std;
int main()
{
int num,i;
cout<<"Enter the number:";
cin>>num;
int sum=0,mult=1,rem;
while(num!=0)
{
rem=num%10;
sum+=rem;
mult*=rem;
num/=10;
}
if(sum==mult)
cout<<"It is a spy Number.";
else
cout<<"It is not a spy Number.";
}
Explanation:
Similar questions