Subscribe For Free Updates!

We'll not spam mate! We promise.

Sunday, 26 August 2012

C code to display in full payment and in installments



// Program to show in full payment and in installments
// Programmer name: Sohail ahmed
// Dated: 07/04/2011

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

void main()
{
clrscr();
float pay, dis, payable;
char op_lop;
int op;
do{ // Starting of Do-while
clrscr();
printf("\nEnter Payment: ");  // input full payment
scanf("%f", &pay);
clrscr();
printf("\n1. Full payment\n2. Two Instalments\n3. Three instalments\n\n");
printf("\nEnter any option: ");  // input of option of above menu
scanf("%d", &op);
clrscr();
switch(op)
{
case 1: // 1st option
{
dis=pay*15/100;
payable=pay-dis;
printf("\n\nTotal amount:\t%.2f", pay);
printf("\n\nDiscount:\t%.2f", dis);
printf("\n\nAmount Payable:\t%.2f", payable);
break;
}               //end
case 2:   // 2nd option
{
dis=pay*10/100;
payable=pay-dis;
printf("\n\nTotal amount:\t%.2f", pay);
printf("\n\nDiscount:\t%.2f", dis);
printf("\n\nAmount Payable:\t%.2f", payable);
printf("\n\nTwo instalments to be paid of amount %.2f", payable/2);
break;
}//end
case 3:  // 3rd option
{
dis=pay*5/100;
payable=pay-dis;
printf("\n\nTotal amount:\t%.2f", pay);
printf("\n\nDiscount:\t%.2f", dis);
printf("\n\nAmount Payable:\t%.2f", payable);
printf("\n\nThree instalments to be paid of amount %.2f", payable/3);
break;
} //end
default:            // default
{
printf("\n\n*****Invalid Option*****");
}
} //end
getch();
clrscr();
printf("\nDo you want to continue(Y OR N):"); // program should b continue or not
op_lop=getche();
}while(op_lop=='y' || op_lop=='Y'); // loop condition
getch();
}

Socializer Widget By CodingLovers
SOCIALIZE IT →
FOLLOW US →
SHARE IT →

0 comments:

Post a Comment