__int64 的显示
_i64toa( s , strs , 10 )
以 _i65toa() 将 __int64 s 打印到字符串 strs 中,
即以字符串数字形式显示 __int64
10 表示字符串数字进制, 10进制
8 8进制
16 16进制
#include "stdio.h"
#include "stdlib.h"
#include "conio.h"
//sn = a0 * n + a1 * (n-1) + a2 * (n-2) + ... + a[n-1] * 1
//a0 = n
//a1 = a0 * n
//a2 = a1 * (n-1)
//a3 = a2 * (n-2)
//...
//a[n-1] = a[n-2] * 1
//__int64也只能处理s[20]
void main()
{
__int64 n = 20;
__int64 a0 = n;
__int64 s = 0;
__int64 i;
char stra[1024];
char stri[1024];
char strs[1024];
for( i = n - 1 ; i >= 1 ; i-- )
{
_i64toa( a0 , stra , 10 );
_i64toa( i , stri , 10 );
printf( "%s * %s " , stra , stri );
if( i > 1 )
printf( "+/n" );
else
printf( "/n" );
s += a0 * i;
a0 = a0 * i;
}
_i64toa( s , strs , 10 );
printf( "/n%s/n" , strs );
getch();
}