PROGRAM ON SUPER MARKET BILLING ON C PROGRAMMING

 PROGRAM ON SUPER MARKET BILLING ON C PROGRAMMING

//NAME:--          ABHAY DWIVEDI
//Reg. No.:--      11109906
//Section:--       K1104
//Roll No.:--      RK1104A28

#include<stdio.h>
#include<conio.h>
struct slip
{
    char name[20];
    int qty;
    int price;
}s[100];
void main()
{
    int i,n,j=1;
    float d,t3=0,t=0,t1=0,t2=0,s1=0;
    clrscr();
    printf("\n\n\n\n\n\n\n            WELCOME TO SUPER MARKET BILLING");
    getch();
    clrscr();
    printf("ENTER NO. OF ITEM PURCHASE   :");
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        printf("ENTER %d ITEM NAME PURCHASE   :",i);
        scanf("%s",&s[i].name);
        printf("ENTER ITS QUANTIY  :");
        scanf("%d",&s[i].qty);
        printf("ENTER ITS PRICE   :");
        scanf("%d",&s[i].price);
    }
    clrscr();
    printf("\n\t\t\tPURCHASE BILL\n\n\n");
    gotoxy(1,6);
    printf("ITEM NAME  ");
    gotoxy(14,6);
    printf("QUANTITY  ");
    gotoxy(25,6);
    printf("PRICE ");
    gotoxy(35,6);
    printf("VAT ");
    gotoxy(40,6);
    printf("DISCOUNT");
    gotoxy(55,6);
    printf("TOTAL PRICE ");
    gotoxy(1,7);
    printf    ("_______________________________________________________________________");
    for(i=1;i<=n;i++)
    {
        gotoxy(1,8+j);
        printf("%s",s[i].name);
        gotoxy(14,8+j);
        printf("%d",s[i].qty);
        gotoxy(25,8+j);
        printf("%d",s[i].price);
        gotoxy(35,8+j);
        printf("5%");


        t=s[i].qty*s[i].price;
        t2=t+(0.05*t);

        if(t2<=2000)
        {
            gotoxy(40,8+j);
            printf("0%");
        }
        else
        if(t2>2000&&t2<5000)
        {
            d=10;
            gotoxy(40,8+j);
            printf("%f%",d);
        }
        else
        if(t2>=5000)
        {
            d=20;
            gotoxy(40,8+j);
            printf("%f%",d);
        }
        gotoxy(55,8+j);
        t3=(d/100)*t2;
        t1=t2- t3;
        printf("%f",t1);
        s1=s1+t1;
        j=j+2;
        t=0;
        t1=0;

    }
    printf("\n_______________________________________________________________________");
    printf("\n\nTOTAL SUM IS : %f",s1);
    getch();
    clrscr();
    printf(" \n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t\tTHANKS FOR USING SOFTWARE");
    getch();
}



0 comments: