diff --git a/kaprekar_number.cpp b/kaprekar_number.cpp new file mode 100644 index 0000000..eddffc8 --- /dev/null +++ b/kaprekar_number.cpp @@ -0,0 +1,37 @@ +#include +#include +using namespace std; +int sum(int n) + { + int m=n,d=0; + int s=m*m; + //while loop begins to count the number of digits + while(n!=0) + { + d++; + n=n/10; + } + int a=s%(int)pow(10,d); + int b=s/(int)pow(10,d); + int su=a+b; + return(su); + } + int main() + { + int k=0,num,m; + cout<<"Enter the upper and lower limits :"<>num>>m; + //displaying the reasult + cout<<"The kaprekar numbers within "<