Sunday 26 August 2012

Calculating Grand Total on Discount


#include <stdio.h>
#include <conio.h>

void main()
{
                clrscr();

                int a, b, c, d, e;
                float total, discount, discountAmt, grandTotal;

                printf("Enter the 1st amount : ");
                scanf("%d",&a);

                printf("Enter the 2nd amount : ");
                scanf("%d",&b);

                printf("Enter the 3rd amount : ");
                scanf("%d",&c);

                printf("Enter the 4th amount : ");
                scanf("%d",&d);

                printf("Enter the 5th amount : ");
                scanf("%d",&e);

                total = a+b+c+d+e;

                printf("\n\nTotal = Rs. %.f",total);

                if(total>5000)
                {
                                discount = 5;
                }
                else
                {
                                discount = 3;
                }

                printf("\n\nYou will get %.f discount.",discount);

                discountAmt = ((float) discount/100) * total;

                grandTotal = total - discountAmt;

                printf("\n\nDiscount Amount = Rs. %.f",discountAmt);

                printf("\n\Total Amount =  Rs. %.f",grandTotal);

                getch();
}

7 comments:

  1. Hello! I just would like to give you a big thumbs
    up for your great info you've got right here on this post.
    I'll be returning to your website for more soon.

    my web blog; minecraft download

    ReplyDelete
  2. naturally like your web-site however you have to check
    the spelling on several of your posts. Several of them
    are rife with spelling issues and I to find it very bothersome to inform the truth then again I will certainly come back again.

    Feel free to surf to my site; here.

    ReplyDelete
  3. Pretty! This has been an extremely wonderful article.
    Thanks for providing this information.

    my page :: we buy houses fast

    ReplyDelete
  4. I'm gone to inform my little brother, that he should also visit this weblog on regular basis
    to take updated from hottest gossip.

    My website best tips

    ReplyDelete
  5. Spot on with this write-up, I honestly believe this website needs a great deal more attention. I'll probably be back again to read more,
    thanks for the information!

    my blog post ... royalty free music scores

    ReplyDelete
  6. I pay a visit daily a few sites and sites to read
    articles or reviews, except this weblog presents quality based
    content.

    Also visit my site - best seo london

    ReplyDelete
  7. Hello my loved one! I want to say that this article is amazing, great written and
    come with approximately all vital infos. I'd like to see more posts like
    this .

    my webpage :: corporate jet hire

    ReplyDelete