Back To C User Defined Functions Index
//program to create a function that inputs price and rate of discount from the user and calculates discount amount #include
#include
void calcdiscount(float,float); void calcdiscount(float price,float discount) { float disprice; disprice=price*(discount/100); printf("discount amount is %f",disprice); } void main() { float p,d; clrscr(); printf("enter price"); scanf("%f",&p); printf("enter discount as percentage"); scanf("%f",&d); calcdiscount(p,d); getch(); }