Untitled

 avatar
unknown
c_cpp
5 months ago
831 B
8
Indexable
// Online C compiler to run C program online
#include <stdio.h>

void divisione(int n, int d, int *quoziente, int *resto)
{
     *quoziente = n / d;
     *resto = n % d;
}

int main() {
    int num= 10;
    int denom = 3;
    int quoziente, resto;
    divisione(num, denom, &quoziente, &resto);
    printf("%d\n", quoziente);
    printf("%d", resto);
    
    return 0;
}



// Online C compiler to run C program online
#include <stdio.h>

typedef struct{
    int quoziente;
    int resto;
} Risultato;

Risultato divisione(int a, int b)
{
    Risultato res;
    res.quoziente = a/b;
    res.resto = a % b;
    return res;
}

int main() {
    int num = 10, denom = 3;
    
    Risultato res = divisione(num, denom);
    printf("Quoziente: %d\n", res.quoziente);
    printf("Resto: %d\n", res.resto);
    

    return 0;
}









Editor is loading...
Leave a Comment