[C 언어] "회문수"의 판단

1227 단어

#include<stdio.h>
#include<math.h>
int main()
{
	int num=0;
	int num1=0;
	double fannum=0;
	int a[100];
	int i=0;
	int j=0;
	int size=0;
	scanf("%d",&num);
	num1=num;
	while(num1%10)
	{
		a[i]=num1%10;
		num1=num1/10;
		i++;
		size++;
	}
	for(j=0;j<i;j++)
	{
		size--;
		fannum=fannum+a[j]*pow(10,size);
	}
	if(fannum == num)
		printf("num is    
"); else printf("num is't
"); return 0; }
<img src="http://img.blog.csdn.net/20150426102548293?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhhbmdjaGFvcQ==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />



<img src="http://img.blog.csdn.net/20150426102541953?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhhbmdjaGFvcQ==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />

좋은 웹페이지 즐겨찾기