Browse Source

multiplication by prime and its square

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

8
src/multiplication.c

@ -1,7 +1,7 @@
#include "multiplication.h"
#include <stdio.h>
#include <string.h>
#include <math.h>
double multi( double ein1, double ein2) {
@ -31,7 +31,7 @@ float multiply_by_percentage(float num, float percentage) {
}
int multiply_by_random(int num) {
int random_factor = rand() % 10 + 1;
int random_factor = random_factor % 10 + 1;
return num * random_factor;
}
@ -108,5 +108,9 @@ int multiply_using_increment(int num1, int num2) {
return result;
}
int multiply_by_prime_and_its_square(int num, int prime) {
return num * (prime + square (prime));
}

1
src/multiplication.h

@ -17,6 +17,7 @@ int multiply_using_logical_operations(int num1, int num2);
int multiply_using_modulo(int num1, int num2, int modulo);
int multiply_by_prime(int num, int prime);
int multiply_using_increment(int num1, int num2);
int multiply_by_prime_and_its_square(int num, int prime);
#endif // MULTIPLICATION_H

Loading…
Cancel
Save