简体   繁体   中英

c language: printf help

here is my coding which gives me the error 'warning: unknown conversion type character 0x20 in format'

int subtotal;
long long a,b,c,d,e,f,g,h,i,j,k,l,m;
subtotal = (1*(a+c+e+g+i+k))+(3*(b+d+f+h+j+l));
printf(" = %d % 10 = %d; (10 - %d) % 10 = %lld\n", subtotal,subtotal%10,subtotal%10,m);

any idea why this is wrong?

忽略你有一堆未初始化变量的事实,%字符是printf格式字符串中的特殊字符 - 如果你想要文字'%',你需要'%%'。

printf(" = %d %% 10 = %d; (10 - %d) %% 10 = %lld\n", subtotal,subtotal%10,subtotal%10,m);

printf你需要一个转义字符打印% ,你需要使用的控制台%%

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM