Answer to Question #259476 in C for jbs

Question #259476

One metric ton is approximately 2205 pounds. Write a program that prompts the user to input the amount of rice, in pounds, in a bag. The program outputs the number of bags needed to store one metric ton of rice.



1
Expert's answer
2021-10-31T18:40:55-0400
#include <stdio.h>
#define POUNTS_PER_TON 2205

int main() {
    int pounds_in_bag;
    int bag_number;

    printf("Enter aa amount of pounds in one rice bag: ");
    scanf("%d", & pounds_in_bag);
    bag_number = POUNTS_PER_TON / pounds_in_bag 
               + (POUNTS_PER_TON % pounds_in_bag ? 1 : 0);
    printf("You need %d bags  to pack one ton of rice\n");

    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS