The following code should take the isbnSum variable and divide is by 11 and if the answer is evenly divided then it should return 1 to the isValid boolean.
I am not sure on what technique or approach I should take in order to do so. Can someone possibly point me in the right direction?
I am not sure on what technique or approach I should take in order to do so. Can someone possibly point me in the right direction?
Code:
#include <stdafx.h>
int isbn[10];
int main()
{
bool isValid;
int isbnSum=0;
int i;
for (i=0;i<10;i++)
{
printf("Enter digit # %d of isbn number.\n", i + 1);
scanf("%d", &isbn[i]);
}
for (i=0;i<10;i++)
{
isbnSum += isbn[i];
}
isValid = (isbnSum / 11);
if(isValid)
printf("isbn is valid.\n");
else
printf("isbn is invalid\n");
return 0;
}