Browse Source

multiplication by random

remotes/origin/multiplication
fdai7930 11 months ago
parent
commit
d39998fe0f
  1. 5
      src/multiplication.c
  2. 2
      src/multiplication.h

5
src/multiplication.c

@ -28,6 +28,11 @@ float multiply_by_percentage(float num, float percentage) {
return num * (percentage / 100); return num * (percentage / 100);
} }
int multiply_by_random(int num) {
int random_factor = rand() % 10 + 1;
return num * random_factor;
}

2
src/multiplication.h

@ -7,5 +7,7 @@ int multiply_left_shift(int a, int b);
int multiply_right_shift(int a, int b); int multiply_right_shift(int a, int b);
int multiply_by_ten(int a); int multiply_by_ten(int a);
float multiply_by_percentage(float num, float percentage); float multiply_by_percentage(float num, float percentage);
int multiply_by_random(int num);
#endif // MULTIPLICATION_H #endif // MULTIPLICATION_H
Loading…
Cancel
Save