Created
July 27, 2016 22:12
-
-
Save gregheo/63573aa24c4b41b2e2218e545adc67e7 to your computer and use it in GitHub Desktop.
remainder()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <math.h> | |
int main(void) { | |
double const number = 8.0; | |
for (double i = number; i < number * 2 + 1; ++i) { | |
printf("remainder(%2.0f, %2.0f) = %2.0f\n", i, number, remainder(i, number)); | |
} | |
return 0; | |
} | |
/* output: | |
remainder( 8, 8) = 0 | |
remainder( 9, 8) = 1 | |
remainder(10, 8) = 2 | |
remainder(11, 8) = 3 | |
remainder(12, 8) = -4 | |
remainder(13, 8) = -3 | |
remainder(14, 8) = -2 | |
remainder(15, 8) = -1 | |
remainder(16, 8) = 0 | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment