int a=5;
int b=10;
int percent=a/b100;
//這樣是錯誤的,因為根據(jù)類型的話就是0;
int a=5;
int b=10;
int percent=a * 100 / b;
//這樣就得到正確的百分比