Divide decimals (number of books you can buy with a set budget)
Fri Feb 23 2024 21:36:55 GMT+0000 (Coordinated Universal Time)
Saved by
@NoobAl
#include <stdio.h>
int main (void) {
double Budget, Price;
int NumberofBooks;
scanf ("%lf %lf", &Budget, &Price);
NumberofBooks = (int) (Budget/Price);/*if you remove the parentheses "budget" will become an integer first and the answer may be incorrect*/
printf ("%d", NumberofBooks);
return 0;
}
content_copyCOPY
Comments