Friday, 9 January 2015

Write a program Check Whether the given number is Strange or Not

//write a program Check Whether the given number is Strange or Not.

#include<iostream>
using namespace std;
//base class
class strange
{
public:
void setdigit(int d)
{
digit=d;
}
protected:
int digit;
};
//derived class
class number : public strange
{
public:
int i,j,t=1,d;
int devide()
{
while(d!=0)
{
j=d%10;
d=d/10;
for(i=2;i<j;i++)
{
if(j%i==0)
{
t=0;
i=j;
}
}
}
}
int check()
{
if(t==1)
cout<<"number is strange";
else
cout<<"number is not strange";
}
};
int main()
{
number hh;
int a;
cin>>a;
hh.setdigit(a);
hh.check();
}

No comments:

Post a Comment