Array a of ints contains the digits of a number. For this example I'll insert random numbers but the code must work for any set of numbers. I have to add together the ints in the array and then store the last digit in that sum into a variable called checksum.
In this example, 3 + 5 + 7 = 15 so checksum would = 5. Here's my code so far. How would I go about calculating the checksum?
int[] a = { 3, 5, 7 };
int checksum = 0;
int i = 0;
while ( i < a.length )
{
checksum += a[i];
i++;
}
checksum = ???????;