摘要: 计算阶乘 #include <stdio.h> double fact(int); int main() { int x; printf("input a positive integer (<20) to calculate its factorial: "); scanf("%d", &x); 阅读全文
posted @ 2020-06-06 21:47 profesor 阅读(223) 评论(0) 推荐(0)
摘要: from functools import reduce i = int(input("input a number 1-10: ")) result = reduce(lambda a, b: a*b, [item for item in range(1,i+1)]) print(f'factor 阅读全文
posted @ 2020-06-06 20:57 profesor 阅读(152) 评论(0) 推荐(0)
摘要: JAVA:Math.ceil() , Math.floor() C: ceil(), floor() 阅读全文
posted @ 2020-06-06 09:08 profesor 阅读(151) 评论(0) 推荐(0)
摘要: #include <stdio.h> int main() { int a = 0; while (a < 10){ printf("a is %d\n", a); if ( a == 5) goto OUT; a++; } OUT: printf("We're out of the loop.\n 阅读全文
posted @ 2020-06-06 07:56 profesor 阅读(97) 评论(0) 推荐(0)
摘要: #include <stdio.h> #include <string.h> typedef union Person { char name[10]; int age; } pinfo; int main() { pinfo man1; strcpy(man1.name, "Jerry"); pr 阅读全文
posted @ 2020-06-06 07:54 profesor 阅读(80) 评论(0) 推荐(0)