OOP

Sunday, December 7, 2014

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

#include<iostream>
using namespace std;
int main ()
{
int X,Y,D,prime num=1;
cin>>D;
while(D!=0)
{
X=D/10;
Y=D%10;
cout<<Y<<endl;
D=X;

for(int j=2; j<Y; j++)
{
if(Y%j==0)
{prime num=0;
j=Y;
}
}
}
if(prime num==1) cout<<"stange";
else
cout<<" not stange";
return 0;
}
Posted by Unknown at 7:57 AM
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

About Me

Unknown
View my complete profile

Blog Archive

  • ▼  2014 (12)
    • ▼  December (12)
      • Write a program Check Perfect Number using Inherit...
      • Search an element in an Array of 20 integer values...
      • Write a c++ program to count number of character i...
      • Write a c++ program to check whether the given num...
      • Write a program of function to Sum of all even ele...
      • Write a program Check whether the given number is ...
      • Write a program Check Whether the given number is ...
      • Write a C++ program to find area of triangle, circ...
      • Write a C++ program using class to calculate simpl...
      • write a program calculate square and cube of given...
      • Write a program performing as calculator which all...
      • WELLCOME
Awesome Inc. theme. Powered by Blogger.