From c8b892049cf0c7ed8c7f3b5c384cfb1702e6eb9e Mon Sep 17 00:00:00 2001 From: DAyama Date: Wed, 17 May 2017 16:47:42 +0900 Subject: [PATCH] add c solution to statement --- string/statement.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/string/statement.md b/string/statement.md index fe9bbcf..bb97d51 100644 --- a/string/statement.md +++ b/string/statement.md @@ -59,7 +59,24 @@ i ## C ``` - +#include +#include + +char buf[200]; + +int main(int argc, char const *argv[]) +{ + int T; + scanf("%d", &T); + while(T--){ + int n, k; + scanf("%s %d", buf, &k); + n = strlen(buf); + if(k > n)printf("*\n"); + else printf("%c\n", buf[k-1]); + } + return 0; +} ``` ## Java