#include <stdio.h>
int main(void)
{
float price, vat, vatless, vatprice;
int vatpercentage;
printf("Enter the price of the item:\n ");
scanf_s("%f", &price);
printf("what is the current vat: \n");
scanf_s("%d", &vatpercentage);
vatpercentage = (float) (vatpercentage / 100);
vat = (float) (vatpercentage * vatpercentage);
vatless = price / vat;
vatprice = price - vatless;
printf("Total = %.2f\n", price);
printf("Your vatless price is %.2f\n", vatless);
printf("your vatprice is %.2f\n", vatprice);
return 0;
}
Hello trying to make a vat calculator but I can't really figure out why I'm only getting inf and - inf when I try this code.