Skip to content

Commit

Permalink
Solve security warnings in C++
Browse files Browse the repository at this point in the history
  • Loading branch information
LivInTheLookingGlass committed Aug 7, 2024
1 parent 77a0b00 commit 4aaa8c2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cplusplus/src/p0020.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ unsigned long long p0020() {
const unsigned long long ten17 = 100000000000000000;
numbers[0] = 1;
for (unsigned char i = 2; i <= 100; i++) {
for (unsigned char j = 0; j < numbers.size(); j++) {
for (size_t j = 0; j < numbers.size(); j++) {
numbers[j] *= i;
}
for (unsigned char j = 0; j < numbers.size() - 1; j++) {
for (size_t j = 0; j < numbers.size() - 1; j++) {
if (numbers[j] > ten17) {
numbers[j + 1] += numbers[j] / ten17;
numbers[j] %= ten17;
Expand All @@ -34,7 +34,7 @@ unsigned long long p0020() {
unsigned long long answer = 0;
unsigned long long power = 1;
for (unsigned char i = 0; i < 18; i++) {
for (unsigned char j = 0; j < numbers.size(); j++) {
for (size_t j = 0; j < numbers.size(); j++) {
answer += (numbers[j] / power) % 10;
}
power *= 10;
Expand Down

0 comments on commit 4aaa8c2

Please sign in to comment.