FUNCTIONS
the question is as follows: write a function, ComputeAmount, that takes as input the quantity of an item and the item unit price, and returns the net amount to be paid by customer.
my program is working correctly please advise me what i did wrong here are the codes:
#include<stdio.h>
#include<stdlib.h>
int ComputeAmount(int x, int y);
int main()
{
int q, amt;
printf("Enter quatity: ");
scanf("%d", &q);
printf("Enter amount: ");
scanf("%d", &amt);
system("pause");
return 1;
}
int ComputeAmount(int x, int y)
{
int amt, q;
float netAmount;
if(amt<=100){
netAmount=q*amt;
return("%.2f", netAmount);
}
else
if(amt<=200){
netAmount=q*(amt*(5/100));
return("%.2f", netAmount);
}
else
if(amt<=300){
netAmount=q*(amt*(7.5/100));
return("%.2f", netAmount);
}
if(amt>300){
netAmount=q*(amt*(15/100));
return("%.2f", netAmount);
}
else
printf("wrong purchase\n");
}