Last active
December 25, 2015 09:29
-
-
Save boxmein/6954339 to your computer and use it in GitHub Desktop.
A script that demonstrates integer division in C. Prints two numbers, the first with integer division and the second with floating division. Integer division is achieved by having the divisor be an integer.
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
/* | |
A script that demonstrates integer division in C. | |
Prints two numbers, the first with integer division | |
and the second with floating division. | |
Integer division is achieved by having the divisor | |
be an integer. | |
Compile with anything really. Running produces the | |
following output: | |
0 0.333333 | |
*/ | |
#include <stdio.h> | |
int main(int argc, char **argv) { | |
printf("%d ", 1/3); | |
printf("%f\n", 1.0f/3.0f); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment