1、回文数(逆序数)main() long x,y=0,t;scanf(“%ld”,t=x;while(x!=0) y=y*10+x%10; x=x/10;if(t=y) printf(“yes”);else printf(“no”);#include #include main() float s=0,t=1;int f=1,k=1;while(fabs(t)=1e-6) /*1 通项加到 s 上*/s+=t;/*2 调整通项*/f=-f; k=k+2; t=1.0*f/k;printf(“s=%f”,4*s);P77 eg5.2main() float sum=0,t=1;int f=1,k=
2、0;while(fabs(t)1e-4) sum=sum+t;f=-f; k=k+1; t=1.0*f/k/(k+1);printf(“sum=%f”,sum);穷举法main() int x,g,s,b,n=0;x=100;while(xb) x=a;a=b;b=x;for(x=a;x=b;+x) flag=1; for(i=2;i=x/2;i+)if(x%i=0) flag=0;if(flag) printf(“%d “,x);n+; if(n%6=0) printf(“n”);九九乘法表main() int i,j;for(i=1;i=9;i+) /*行*/ for(j=1;j=9;j+) /*列*/printf(“%d*%d=%2d “,i,j,i*j);printf(“n”);