#include <stdio.h>

// Function prototype
void divide_and_mod(int *a, int *b);

int main() {
    int num1 = 10;  // Example value for *a
    int num2 = 3;   // Example value for *b

    printf("Avant la fonction:\n");
    printf("num1 = %d\n", num1);
    printf("num2 = %d\n", num2);

    // Call the function with the addresses of num1 and num2
    divide_and_mod(&num1, &num2);

    printf("Apres l'appel de la fonction:\n");
    printf("La nouvelle valeur stocke dans num1 (div) = %d\n", num1);
    printf("La nouvelle valeur stocke dans num2 (modulo) = %d\n", num2);

    return 0;
}

// Function definition
void divide_and_mod(int *a, int *b) {
    int div;
    int mod;
    div = *a / *b;  // Perform integer division
    mod = *a % *b;  // Calculate the remainder
    *a = div;       // Store the result of division in *a
    *b = mod;       // Store the remainder in *b
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: