f2380eef05
git-subtree-dir: lcthw-remnants git-subtree-mainline:4107485591
git-subtree-split:e172f73c82
37 lines
1.0 KiB
C
37 lines
1.0 KiB
C
#include <stdio.h>
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
int bugs = 100;
|
|
double bug_rate = 1.2;
|
|
|
|
printf("You have %d bugs imaginary rate of %f.\n",
|
|
bugs, bug_rate);
|
|
|
|
unsigned long universe_of_defects = 63.99999999999 * 32 * 1024 * 1024;
|
|
printf("The entire universe has %ld bugs.\n",
|
|
universe_of_defects);
|
|
|
|
double expected_bugs = bugs * bug_rate;
|
|
printf("You are expected to have %f bugs.\n",
|
|
expected_bugs);
|
|
|
|
double part_of_universe = expected_bugs / universe_of_defects;
|
|
printf("That is only a %e portion of the universe.\n",
|
|
part_of_universe);
|
|
|
|
// this makes no sense, just a demo of something weird
|
|
char nul_byte = '\0';
|
|
int care_percentage = bugs * nul_byte;
|
|
printf("Which means you should care %d%%.\n",
|
|
care_percentage);
|
|
|
|
puts("also...");
|
|
int nul = (int)nul_byte;
|
|
int *nul_ptr = &nul;
|
|
printf("char '\\0' = '%c', (int)'\\0' = '%d', &(int)'\\0' = '%n'.\n",
|
|
nul_byte, nul, nul_ptr);
|
|
|
|
return 0;
|
|
}
|