#include #include #include float checkPrice(float min, float max){ float num; int check; char c; do{ check=scanf("%f%c", &num, &c);//Returns the value of an integer if(check!=2||c != '\n' || num<=min || num>max){ printf("Please enter again!!!\n\tEnter a real number: "); fflush(stdin);//Delete buffer check=0; //input is a character } else{ check=1; //input is a number } }while(check==0); return num; } int checkInVi(int min, int max){ int num; int check; char c; do{ check=scanf("%d%c", &num, &c);//Returns the value of an integer if(check!=2||c != '\n' || nummax){ printf("Please enter again!!!\n\tEnter a positive number: "); fflush(stdin);//Delete buffer check=0; //input is a character } else{ check=1; //input is a number } }while(check==0); return num; } int main(){ int packetSmall=50, packetBig=200;//suc chua cua hop to, nho float priceSmall, priceBig,price; int n, small=0,big=0; printf("What is the cost of a small package (indolars)?"); priceSmall=checkPrice(0.0,500.0); printf("What is the cost of a large package (indolars)?"); priceBig=checkPrice(0.0,500.0); printf("How many invitations are you sending out? "); n=checkInVi(1,10000); if(priceSmall*packetBig/packetSmall