Hi everyone;
My homework is this.A Bookseller makes special discount for multiple orders of a book as follows: AMOUNT and DISCOUNT as follows.5-9 5% 10-14 10% 15-19 15% 20+ 20% Write a C main function to read the amount of order from the standardinput and compute and print the total price of the given order after thediscount. Assume that unit price of a book is 10.00$
my problem is that.When i start with this
Code:
#include<stdio.h>
#include <stdlib.h>
int main(void)
{
int number;
float TotalPrice;
printf("enter a number:");
scanf("%d",&number);
if(number<=5) {
printf("Your Total Price is :%d", TotalPrice);
TotalPrice=number*10;
system("PAUSE");
return 0;
}}
i get 0 if i enter a number between 0 and 4(0 and 4 included)
i dont know where im doing a mistake.
i also want to know if i can handle this buy just if statements.
or how can i do it by while and for loops ?
Thank you.