PropellerAds
Posted by : Unknown Wednesday, 24 December 2014

Allah Ditta wants a program that calculates and displays the amount he should tip a waiter at a restaurant. The program should subtract any cold drink charges from the total bill and then calculate the tip (using a percentage) on the remainder.


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

//executing main program
void main() 
{
//creating integers to store data
int i;
int j;
int k;


//Taking input from user:
//total bill
printf("Enter the total bill: ");
scanf("%d", &i);

//tip percentage
printf("Enter the percentage amount of tip: ");
scanf("%d", &j);

//cold drinks 
printf("Enter the cost of cold drinks: ");
scanf("%d", &k);

//calculating Displaying result
printf("\n \nThe tip is: %d ", ((i-k)*j)/100);

//for disabling automatic close off of program after execution of program
_getch();
}



these are coding samples to help you understand more and more.

Leave a Reply

Subscribe to Posts | Subscribe to Comments

PropellerAds
PropellerAds

Popular Post

Powered by Blogger.

- Copyright © BSCS -Metrominimalist- Powered by Blogger - Designed by Johanes Djogan -