Check Strange number or Not
#include<stdio.h>
int main()
{
int a,b,n,j,temp=0;
printf("Enter the number:");
scanf("%d",&a);
temp=a;
while(temp>0)
{
j=temp%10;
n=1;
for(b=2;b<=j/2;b++)
{
if(j%b==0)
{
n=0;
break;
}
}
temp=temp/10;
}
if(n==1)
printf("YES! %d is a Strange number ",a);
else
printf("No! %d is Not a strange number ",a);
}
#include<stdio.h>
int main()
{
int a,b,n,j,temp=0;
printf("Enter the number:");
scanf("%d",&a);
temp=a;
while(temp>0)
{
j=temp%10;
n=1;
for(b=2;b<=j/2;b++)
{
if(j%b==0)
{
n=0;
break;
}
}
temp=temp/10;
}
if(n==1)
printf("YES! %d is a Strange number ",a);
else
printf("No! %d is Not a strange number ",a);
}
I have a problem with this number theory....so explain it brieflly..
ReplyDelete