Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <stdbool.h>
- #include <math.h>
- float unit_price(const float pack_price, const int rolls_count, const int pieces_count);
- int main() {
- printf("%.4f\n", unit_price(5.63, 20, 200));
- //printf("%.4f\n", unit_price(4.79, 16, 150));
- return 0;
- }
- float unit_price(const float pack_price, const int rolls_count, const int pieces_count) {
- float result;
- result = (pack_price*100)/(rolls_count*pieces_count);
- result = result*100;
- result = round(result);
- result = result/100;
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement