Program in C That Calculates a Price of Chosen Products

Hello there, I need to make a seemingly simple program that would calculate a price of three products (chosen by the user from a list), but for some reason the program stops right at the calculation point and shows a zero. I’m very new to C, just started learning and don’t understand why the price seems to be undeclared identifier…

#include <stdio.h>

int main(void)
	float weight; cost; price;
	int productCode;
	printf("Choose one of the available products Potatoes, Tomatoes, Cucumbers\n");
	scanf("%d", &productCode);
	printf("Insert the weight of the product in kg\n>");
	scanf("%f", &weight);
	switch (productCode)
		case 1:
			printf("Product %d - Potatoes\n");
			price = 1.10;
		case 2:
			printf("Product %d - Tomatoes\n");
			price = 3.40;
		case 3:
			printf("Product %d = Cucumbers\n");
			price = 2.70
			&price = 0;
	cost = price * weight;
	printf("Cost is %f\n, cost");
return 0;

It’s the semicolons between the variable names. Semicolon means a new, independent instruction, the float at the beginning of the line becomes meaningless for the new instruction. If you want to declare multiple variables at once you must separate them by commas:

	float weight, cost, price;

There are a few more issues your compiler should point out, specifically one missing semicolon and a bunch of printfs with missing arguments.