This question already has an answer here:
I have program for calculate rate. I don't know why "com" is 0 every time.
When I input "Total" that differrent. Where the what's wrong?
Help me check this code please.
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int total;
int com;
while(true)
{
System.out.println("input total sales");
total = sc.nextInt();
if(total < 10000)
{
com = total*(0/100);
System.out.println(com);
}
else if(total >= 10000 && total < 25000)
{
com = total*(7/100);
System.out.println(com);
}
else if(total >= 25000)
{
com = total*(10/100);
System.out.println(com);
}
else if(total < 0)
{
break;
}
}
}
Aucun commentaire:
Enregistrer un commentaire