Answer to Question #340342 in C++ for tomas muller

Question #340342

Write a C program to implement a basic billing system for a bookshop that accepts book code and book price for 10 books and at the end, display the total price.


1
Expert's answer
2022-05-12T17:15:15-0400
#include <stdio.h>


int main()
{
    long int number;
    float price;
    
    float total = 0;
    
    for(unsigned int i = 1; i <= 10; ++i)
    {
        printf("%u) Enter the book code: ", i);
        scanf("%ld", &number);
        
        printf("%s", "   Enter the book price: ");
        scanf("%f", &price);
        
        total += price;
        puts("");
    }
    
    puts("");
    printf("Total price is %.2f\n", total);
}

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