#include<stdio.h>
void main() {
/* code */
int n,k,ca,c,e,nb=1;
do
{
printf("please entre a positive number :");
scanf("%d",&n);
} while (n<0);
int d=n;
do
{
nb*=10;
d=d/10;
} while (d != 0);
ca = n*n;
c = ca / nb;
e = ca % nb;
k= c+e;
if (k==n)
{
printf("it's a kaprekar number\n");
}
else
{
printf("it's not a kaprekar number\n");
}
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.