int n;
const int MAXBUF = 256;
char buf[MAXBUF];
fgets(buf, MAXBUF, stdin);
n = atoi(buf);
おっと、これ以上は有料サポートだ。