Lines Matching defs:percent
2 * percent.c - Take percentage of a number
18 unsigned int e2p_percent(int percent, unsigned int base)
22 if (!percent)
24 if (100 % percent == 0)
25 return base / (100 / percent);
27 return (base / 100) * percent;
28 return base * percent / 100;
38 int percent;
43 fprintf(stderr, "Usage: %s percent base\n", argv[0]);
47 percent = strtoul(argv[1], &p, 0);
49 fprintf(stderr, "Bad percent: %s\n", argv[1]);
59 printf("%d percent of %u is %u.\n", percent, base,
60 e2p_percent(percent, base));