Factorial

#include<stdio.h>
void main(){
	int num,i,fact=1;
	printf("Enter any number:\n");
	scanf("%d",&num);
	for(i=num;i>1;i--){
		fact=fact*i;
	}
	printf("The factorial is %d\n",fact);
}
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");
	}
}