I'm a beginner with java and I don't know whats wrong with my code. Your assistance will be highly appreciated.
This code should check if any element of the array is less than tc
, then its value should be incremented.
int pay1 = 190;
int pay2 = 1175;
int pay3 = 455;
int pay4 = 345;
int tc = 400;
int[] pay = { pay1, pay2, pay3, pay4 };
for(int i = 0; i < pay.length; i++)
{
if(pay[i] < tc)
{
pay[i] = pay[i]++;
System.out.println(pay[i]+",");
}
}