Skip to content

Commit

Permalink
Merge pull request TheAlgorithms#192 from Manoj7117/patch-1
Browse files Browse the repository at this point in the history
number invalid if number >= base
  • Loading branch information
ashwek authored Mar 22, 2019
2 parents 99d2d91 + 37314fb commit 2fde23c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion conversions/toDecimal.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ int main(void) {
else
number[i] = base + 1;

if (number[i] > base)
if (number[i] >= base){
printf("invalid number\n");
return 0;
}
}

for (j = 0; j < i; j++) {
Expand Down

0 comments on commit 2fde23c

Please sign in to comment.