为什么不是“int total = (mark/overall) * 100;” 在职的?当我输入 25 和 50 时,计算 25/50 * 100 后应该是 50%。但它显示的是 0%,这很奇怪。有什么建议么??
public class MarksCalculator {
private static Scanner kb = new Scanner(System.in);
public static void main (String[]args) {
int mark = 0, overall = 0;
//System.out.print("Hello Deepo! To calculate the marks enter value (percantage) of the task: ");
//int weight = kb.nextInt();
System.out.print("Enter your marks for this Task/Assesment/Test: ");
mark = kb.nextInt();
System.out.print("What was this mark out of: ");
overall = kb.nextInt();
int total = (mark/overall) * 100;
System.out.println("You have scored " + total + "% with this assesment.");
}
}