#include <stdio.h>
void divide(int dividend, int divisor, int* p_quotient, int* p_remainder);
int main(void)
{
int numerator = 0;
printf("Dividend? ");
scanf("%d", &numerator);
int denominator = 0;
printf("\nDivisor?");
scanf("%d", &denominator);
int quotient;
int remainder;
// TODO: Call divide...
divide(numerator, denominator, "ient, &remainder);
printf("\nQuotient is %d\n", quotient);
printf("Remainder is %d\n", remainder);
return 0;
}
// TODO: Define divide function:
void divide(int dividend, int divisor, int* p_quotient, int* p_remainder)
{
*p_quotient = dividend / divisor;
*p_remainder = dividend % divisor;
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter