Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int calc_price(int);
- ///////////////////////////////////////////////////////////////////
- int main() //
- {
- for(int i = 1; i <= 10; i++)
- {
- printf("price of %2d books is %5d\n", i, calc_price(i));
- }
- return 0;
- }
- ///////////////////////////////////////////////////////////////////
- int calc_price(int num_of_books) //
- {
- int i = 0,
- price = 0;
- for(i; i < num_of_books; i++)
- {
- price += 1000 - 55 * (i % 7);
- }
- return price;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement