so hanh phuc
/*so hanh phuc*/
#include<stdio.h>
#include<conio.h>
long ktra(long n)
{
int s1=0,s2=0;
s1=s1+n%10;n=n/10;
s1=s1+n%10;n=n/10;
s1=s1+n%10;n=n/10;/*tinh tong 3 so dau*/
s2=s2+n%10;n=n/10;
s2=s2+n%10;n=n/10;
s2=s2+n%10;n=n/10; /*tinh tong 3 so cuoi*/
if(s1==s2)
return 1;/*chuong trinh chay tiep,return 1,2,3,4.....12214 la giong nhau*/
else
return 0;/*chuong trinh ket thuc*/
}
int main()
{
int y=0;
for(long i=0;i<1000000;i++)
if(ktra(i))
{
printf(" %d\t",i);/* \t(Tab)*/
y++;
}
printf("
co %d so hanh phuc",y);
getch();
return 0;
}
Bạn đang đọc truyện trên: AzTruyen.Top