摘要: 1 #include<stdio.h> 2 #include<math.h> 3 int main() 4 { 5 int num, a, b, c, total; 6 scanf("%d", &num); 7 a = num / 100; 8 b = num / 10 % 10; 9 c = nu 阅读全文
posted @ 2020-03-13 20:43 新生代农民工 阅读(108) 评论(0) 推荐(0)
摘要: 为使电文保密,往往按照一定的规律将其转换成密码,收报人再按照约定的规律将其译成原文。例如,某次发报时采用的密码规律为: 将字母A变成字母E,a变成e,即变成其后的第4个字母,W(w)变成A(a),X(x)变成B(b), Y(y)变成C(c),Z(z)变成D(d)。 1 #include<stdio. 阅读全文
posted @ 2020-03-13 20:15 新生代农民工 阅读(344) 评论(0) 推荐(0)
摘要: 1 #include<stdio.h> 2 int main() 3 { 4 int num, a; 5 for (num = 101; num <= 200; num += 2) //从101每次加1循环到200 6 { 7 for (a = 2; a < num; a++) //除数从2开始自加 阅读全文
posted @ 2020-03-13 19:34 新生代农民工 阅读(942) 评论(0) 推荐(0)
摘要: 素数即无法再被2到本身之间的数除尽 思路是 用循环从2到本身前一位数循环取模判断 1 #include<stdio.h> 2 int main() 3 { 4 int num, a, i; //a从2开始做除数给num取模 用一个变量来记录是否能被除尽 除尽一次则加一次 如果一次除不进则为素数 5 阅读全文
posted @ 2020-03-13 16:34 新生代农民工 阅读(576) 评论(0) 推荐(0)
摘要: 把前两位提前赋值输出,然后用循环把他们相加输出 每次都把相加的结果赋值给第二位加数,把第二位的加数赋值给第一位(务必把第二位赋值给第一位先执行否则就是算平方了) 循环相加输出 1 #include<stdio.h> 2 int main() 3 { 4 int a, b, c, d; 5 a = 1 阅读全文
posted @ 2020-03-13 16:10 新生代农民工 阅读(129) 评论(0) 推荐(0)
摘要: 输出4x5的矩阵 1 #include<stdio.h> 2 int main() 3 { 4 int j, k, n = 0; 5 for (j = 1; j <= 4; j++) .//打印列 只要打印换行即可 6 { 7 for (k = 1; k <= 5; k++, n++) //打印行 阅读全文
posted @ 2020-03-13 15:51 新生代农民工 阅读(129) 评论(0) 推荐(0)
摘要: 要求输出100-200的不能被3整除的数 #include<stdio.h>int main(){ int num; for (num = 100; num <= 200;num++) { if (num%3!=0) { printf("%d ", num); } } return 0;} 阅读全文
posted @ 2020-03-13 15:40 新生代农民工 阅读(161) 评论(0) 推荐(0)
摘要: 在全系1000学生中,征集慈善募捐,当总数达到10万元时就结束,统计此时捐款的人数,以及平均每人捐款的数目 #include<stdio.h>#define SUM 100000int main(){ float amount, aver, total; int i; for (i = 1, tot 阅读全文
posted @ 2020-03-13 15:36 新生代农民工 阅读(200) 评论(0) 推荐(0)