摘要: Fibonacci series 输出斐波那契数列前30个数,每行打印5个数 #include <stdio.h> #define MAX 30 int main() { int fib[MAX] = {1,1}; for (int i=2; i<MAX; i++) { fib[i] = fib[i 阅读全文
posted @ 2020-04-30 21:08 profesor 阅读(2266) 评论(0) 推荐(1)
摘要: 找出一维数组中最大最小的数 #include <stdio.h> //找出一维数组中最大最小的数 int main() { int a[] = {1, 2, 4, 7, 10, 15, 17, 20, 100, 90, -1, 1000, 20001, -99}; printf("%p\n", &a 阅读全文
posted @ 2020-04-30 20:13 profesor 阅读(361) 评论(0) 推荐(0)
摘要: 调用函数,计算m~n之间所有整数的和 #include <stdio.h> int sum(int a, int b) { if (a <= b) { int sum = 0, i; for (i = a; i <= b; i++) { sum += i; } return sum; } else 阅读全文
posted @ 2020-04-30 12:17 profesor 阅读(2226) 评论(0) 推荐(0)
摘要: 输入两整数,找出最大的数 #include <stdio.h> int max(int a, int b); int main() { int a, b; scanf("%d%d", &a, &b); printf("%d与%d中的最大数为%d\n", a, b, max(a, b)); retur 阅读全文
posted @ 2020-04-30 12:04 profesor 阅读(404) 评论(0) 推荐(0)
摘要: break下: #include <stdio.h> int main() { int x = 1, a = 0, b = 0; switch(x) { case 0: b++; break; case 1: a++; break; case 2: a++; b++; break; } printf 阅读全文
posted @ 2020-04-28 21:39 profesor 阅读(204) 评论(0) 推荐(0)
摘要: https://www.python.org/dev/peps/pep-0263/ # coding=<encoding name> 阅读全文
posted @ 2020-04-27 16:13 profesor 阅读(86) 评论(0) 推荐(0)
摘要: Python is becoming the world’s most popular coding language But its rivals are unlikely to disappear Jul 26th 2018 “I CERTAINLY didn’t set out to crea 阅读全文
posted @ 2020-04-27 14:27 profesor 阅读(271) 评论(0) 推荐(0)
摘要: 方法一、调用函数 输入下面的代码并保存为factorial.c: /*计算1! + 2! + 3! + ... +100!的值*/ #include <stdio.h> #define MAX 100 double factorial(int a); //函数声明,详细代码往下看 int main( 阅读全文
posted @ 2020-04-26 20:48 profesor 阅读(2920) 评论(0) 推荐(0)
摘要: terminal中,vim isPrime.c,在vim中输入下面的代码。 /* 判断一个正整数是否为素数(prime number) */ #include <stdio.h> #include <math.h> int main() { int number; int i; printf("输入 阅读全文
posted @ 2020-04-26 20:02 profesor 阅读(190) 评论(0) 推荐(0)
摘要: 来源:https://groups.google.com/forum/#!msg/net.unix-wizards/8twfRPM79u0/1xlglzrWrU0J Free Unix! Starting this Thanksgiving I am going to write a complet 阅读全文
posted @ 2020-04-23 12:22 profesor 阅读(154) 评论(0) 推荐(0)