トップ 差分 一覧 Farm ソース 検索 ヘルプ PDF RSS ログイン

2006mdk.c

#include <stdio.h>
int main(void)
{
	int x;
	int ans;
	
	do{
		scanf("%d", &x);
		if (x == 0) break;
		
		ans = x*x+2*x-5;
		
		printf("%d\n", ans);
	}while(-1000<=x && x<=1000 && x != 0);
	
	return(0);
}