为什么下面这串代码运算的值域没有精确到小数点后两位,并且没有打印出百分号呢

#include<stdio.h>

int main()
{
    int count1=20;
    int count2=7;
    printf("您的进度进行至%.2f\%\n", (float)count2 / count1 * 100);
    return 0;
}

打印%用两个%%就可以了,7/20*100等于35,精确到两位小数是35.00,不知道理解对你的意思么?


#include<stdio.h>
 
int main()
{
    int count1=20;
    int count2=7;
    printf("您的进度进行至%.2f\%%%\n", (float)count2 / count1 * 100);
    return 0;
}
 

输出%用%%,而不是\%