#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> #include<string.h> int main() { int i = 0; int k = 0; int sum = 0; int ret = 1; int n = 1; for (n = 1; n <= 10; n++) { ret = 1; for (i = 1; i <= n; i++) { ret = ret*i; } k = ret; sum =sum + k; } printf("sum=%d\n", sum); return 0; }
int main() { int ret = 0; char password[20] = { 0 }; printf("請輸入密碼:>"); scanf("%s", password); while ((getchar()) != '\n') { ; } printf("請確認(Y/N):>"); ret = getchar(); if (ret == 'Y') { printf("確認成功\n"); } else { printf("放棄確認\n"); } return 0; }