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.
#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);
}
Comments
Leave a comment