#include<stdio.h>
#include<stdlib.h>
float sum(float, float, float);

int main()
{
	int meal,quantity,x,y=0;
	float price,price1,price2,price3,tprice;
	
	
	printf("How much food would you like to order?\n");
	scanf("%d", &x);
	printf("Please select your meal \n \n [1] meal 1 - RM 12.00 \n [2] meal 2 - RM 14.00 \n [3] meal 3 - RM 16.00 \n \n");
	
	for(x;y<x;x)
	{
		scanf("%d", &meal);
		if(meal==1)
		{
		printf("How many sets of meal %d do you want\n",meal);
		scanf("%d", &quantity);
		y+=quantity;
		price=12.00;
		price1+= (price*quantity);
		}
		else if(meal==2)
		{
			printf("How many sets of meal %d do you want\n",meal);
			scanf("%d", &quantity);
			y+=quantity;
			price=14.00;
			price2+= (price*quantity);
		}
		else if(meal==3)
		{
			printf("How many sets of meal %d do you want\n",meal);
			scanf("%d", &quantity);
			y+=quantity;
			price=16.00;
			price3+= (price*quantity);
		}
		else
		{
			printf("Invalid");
		}
		if(y==x)
		{
			printf("\n");
		}
		else
		printf("Select your next meal \n \n [1] meal 1 - RM 12.00 \n [2] meal 2 - RM 14.00 \n [3] meal 3 - RM 16.00 \n \n");
	}
	tprice=sum(price1,price2,price3);
	
	printf("The total price of your meals are %.2f", tprice);
	
	

	return 0;
}

float sum(float c, float v, float b)
{
	float tsum;
	tsum=c+b+v;
	return tsum;
	
}
