From 31e75df5408af582efb04592fca331910e91de97 Mon Sep 17 00:00:00 2001 From: "2228628942@qq.com" <2228628942@qq.com> Date: Fri, 4 Jan 2019 13:51:24 +0800 Subject: [PATCH] first commit --- 条件运算符.c | 18 ++++++++++++++++++ 递归.c | 20 ++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 条件运算符.c create mode 100644 递归.c diff --git a/条件运算符.c b/条件运算符.c new file mode 100644 index 0000000..584327f --- /dev/null +++ b/条件运算符.c @@ -0,0 +1,18 @@ +#include +int main(void) +{/* + int a = 40; + a >= 60 ? printf("") : printf("");*/ +// if:else䣻 + + int a = 40; + if (a >= 60 && a <= 100) + { + printf(""); + } + else + { + printf(""); + } + return 0; +} \ No newline at end of file diff --git a/递归.c b/递归.c new file mode 100644 index 0000000..fdd16c2 --- /dev/null +++ b/递归.c @@ -0,0 +1,20 @@ +#include +void solve(int n) { + int temp = n % 10; + /*********Begin*********/ + n /= 10; + if (n > 0) solve(n); + /*********End**********/ + if (n) + printf(" %d", temp); + else + printf("%d", temp); +} +int main(void) +{ + //freopen("in.txt","r",stdin); + int n; + scanf("%d", &n); + solve(n); + return 0; +} \ No newline at end of file