The Question: Write a function main that prompts a user to enter the number of different items that he intends to purchase from a showroom.Your program should read for each item the quantity to purchase and the unit price then finally display total amount to be paid
anyone help me with my codes i am really stuck i am having those errors:
1.switch quantity not an integer
2.case label not within a switch statement
3.break statement not within loop or switch
#include<stdio.h>
#include<stdlib.h>
float ComputeAmount(int x, int y);
int main()
{
int a, totalAmount, z, k;
printf("Enter number of different items to be purchased: ");
scanf("%d", &a);
totalAmount=ComputeAmount(z,k);
system("pause");
return 0;
}
float ComputeAmount(int x, int y){
int a, totalAmount, k, z;
printf("Enter quantity: ");
scanf("%d", &z);
printf("1: k<=100");
printf("2: k<=200");
printf("3: k<=300");
printf("4: k>300");
printf("Enter amount: ");
scanf("%d", &k);
switch("k");{
case 1:{totalAmount=z*k;
break;
}
case 2:{totalAmount=z*(k*0.05);
break;
}
}
return (totalAmount);
}