Kaprekar Number

#include<stdio.h>
void main(){
	int num;
	printf("Enter any number:\n");
	scanf("%d",&num);
	if(num%9==1){
		printf("The number is Kaprekar.\n");
	}else{
		printf("The number is not Kaprekar.\n");
	}
}
Advertisements

Palindrome Number

#include<stdio.h>
void main(){
	int num,temp,rev=0;
	printf("Enter any number:\n");
	scanf("%d",&num);
	for(temp=num;temp>0;temp/=10){
		rev=(rev*10)+(temp%10);
	}
	if(rev==num){
		printf("The number is Palindrome.\n");
	}else{
		printf("The number is not Palindrome.\n");
	}
}