0

Help please, I'm just practicing and it's really annoying to have an error. I tried everything but yeah, failed. lol

#include <stdio.h>
main(){
int order;
int price=5;
int bill;
int billd;
int billf;
scanf("Amount of Order: %d",& order);
if (0<=order<=10);
    bill=(order*price);
    billd=(bill*0.1);
    billf=(bill-billd);
    {
    printf("Bill: %d",billf);
    }
else if(11<=order<=20);
    bill=(order*price);
    billd=(bill*0.2);
    billf=(bill-billd);
    {
    printf("Bill: %d",billf);
    }
else if(21<=order<=40);
    bill=(order*price);
    billd=(bill*0.3);
    billf=(bill-billd);
    {
    printf("Bill: %d",billf);
    }
else;
    bill=(order*price);
    billd=(bill*0.5);
    billf=(bill-billd);
    {
    printf("Bill: %d",billf);
    }
}
2
Contributors
1
Reply
10
Views
1 Year
Discussion Span
Last Post by deceptikon
0

Allow me to reformat your code in the way the compiler sees it. The problem should be easier to locate that way:

#include <stdio.h>
main(){
    int order;
    int price=5;
    int bill;
    int billd;
    int billf;
    scanf("Amount of Order: %d",& order);
    if (0<=order<=10)
        ;
    bill=(order*price);
    billd=(bill*0.1);
    billf=(bill-billd);
    {
        printf("Bill: %d",billf);
    }
    else if(11<=order<=20)
        ;
    bill=(order*price);
    billd=(bill*0.2);
    billf=(bill-billd);
    {
        printf("Bill: %d",billf);
    }
    else if(21<=order<=40)
        ;
    bill=(order*price);
    billd=(bill*0.3);
    billf=(bill-billd);
    {
        printf("Bill: %d",billf);
    }
    else
        ;
    bill=(order*price);
    billd=(bill*0.5);
    billf=(bill-billd);
    {
        printf("Bill: %d",billf);
    }
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.