#include<stdio.h>
#include<math.h>
int main() {
int i,j,k,count=0;
for (i = 101; i <= 200; i++) {
k = sqrt(i);
for (j = 2; j <= k; j++) {
if (i % j == 0)
break;
}
if (j > k)
{
count++;
printf("%4d", i);
if (count % 3 == 0)
printf("\n");
}
}
return 0;
}
#include<stdio.h>
#include<math.h>
int main() {
int n, i,j;
double s;
j = 1;
s = 0;
printf("Enter n(1~10):");
while (scanf("%ld", &n) != EOF) {
for (i = 1; i <= n; i++) {
double k = pow(-1, i - 1);
j = j * i;
s = s + ((1.0/ j) * k);
}
printf("n=%d,s=%lf\n", n, s);
printf("Enter n(1~10):");
}
return 0;
}
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
int main() {
printf("猜猜2020年12月哪一天是你的lucky day\n");
printf("开始喽,你将有三次机会,猜吧(1~31):");
int i, j, x;
srand(time(0));
i = rand() % 31;
for (x = 1; x <= 3; x++) {
scanf("%d", &j);
if(i==j){
printf("猜对了\n");break;
}
if (i < j) {
printf("你猜的时间早了,幸运日还没到呢\n");
}
if (i > j) {
printf("你猜的时间晚了,幸运日过去了\n");
if(x!=3)
printf("再猜:");
}
}
printf("次数用完了,偷偷告诉你你的幸运日是:%d", i);
return 0;
}
时间太长了,不知道保存到哪了,不好意思不好意思。。。比较乱
原文:https://www.cnblogs.com/328302jwh/p/13975175.html