1017-价格查询

代码纯属原创,如有雷同,纯属巧合!

#include 
int main(void)
{
	int n;
	double price[]={3.0,2.5,4.1,10.2};
	printf("[1] apples\n");
	printf("[2] pears\n");
	printf("[3] oranges\n");
	printf("[4] grapes\n");
	printf("[0] Exit\n");
	scanf("%d",&n);
	if(n==0)
		return 0;
	else
		if(n<0 || n>=5)
			printf("price=0");
		else
			printf("price=%.1lf",price[n-1]);
	return 0;
}

你可能感兴趣的:(NOI官网题库)