`#include <stdio.h>
include <stdlib.h>
include <time.h>
define N 5
int main()
{
int number;
int i;
srand( time(0) ); // 以当前系统时间作为随机种子
for(i = 0; i < N; ++i) {
number = rand()%65 + 1;
printf("20238331%04d\n", number);}
system("pause");
return 0;
}![](/i/l/?n=24&i=blog/3405778/202404/3405778-20240414122237988-768996675.png)
int main(){
char color;
while((color=getchar())!=EOF){
switch(color){
case 'y' :printf("wait a minute\n");break;
case 'g' :printf("go go go\n");break;
case 'r' :printf("stop!\n");break;
default :printf("sonthing must be wrong. . . \n");break;}
getchar();
}system("pause");
return 0;
}![](/i/l/?n=24&i=blog/3405778/202404/3405778-20240414122314018-556416357.png)
#include<stdio.h>
include<stdlib.h>
include <time.h>
define N 3
int main(){
int lucky_day;
int i ;
srand(time(0));
lucky_day = rand()%31+1;
printf("猜猜2024年5月哪一天会是你的lucky day\n");
printf("开始咯,你有三次机会,猜吧(1~31):");
for(i=1;i<=N;i++){
int n ;
scanf("%d",&n);
if(lucky_day==n)
{printf("哇,猜中咯:)\n");
break;}
if(lucky_day<n)
printf("你猜的日期晚了,你的lucky day在前面哦\n");
if(lucky_day>n)
printf("你猜的日期早了,你的lucky day在后面哦\n");
if(i>=3)
printf("次数用完啦。偷偷告诉你,5月份你的lucky day是%d",lucky_day);
else
printf("再猜(1~31):");
}
system("pause");
return 0;
}`
`#include <stdio.h>
include <stdlib.h>
int main() {
int n, a,k, i;
double s;
while (scanf("%d%d", &n, &a) != EOF) {
s = 0.0;
k = a;
for (i = 1; i <= n; i++) {
s += (double)i / a;
a+=a*10;
}
printf("n=%d,a=%d,s=%1f\n\n", n, k, s);
}
system("pause");
return 0;
}
![](/i/l/?n=24&i=blog/3405778/202404/3405778-20240414122621573-64429114.png)
#include <stdio.h>
include <stdlib.h>
define N 9
int main(){
int line,col,k;
for(line=1;line<=9;line++)
{ for(col=1;col<=line;col++)
{k=linecol;
printf("%d%d=%d\t",line,col,k);}
printf("\n");}
system("pause");
return 0;
}`
`#include <stdio.h>
include <stdlib.h>
int main() {
int n, i, k, j;
printf("input n:");
scanf("%d", &n);
for (i = 0; i < n; i++)
{
for (j = 0; j < i; j++)
{
printf("\t");
}
for (k = 2 * (n-i) - 1; k>0; k--)
{
printf(" O \t");
}
printf("\n");
for (j = 0; j < i; j++)
{
printf("\t");
}
for (k = 2 * (n-i) - 1; k>0; k--) {
printf("<H>\t");
}
printf("\n");
for (j = 0; j < i; j++)
{
printf("\t");
}
for (k = 2 * (n - i) - 1; k > 0; k--)
{
printf("I I\t");
}
printf("\n");
}system("pause");
return 0;
}`
标签:int,lucky,实验,printf,3405778,include,day From: https://www.cnblogs.com/auror27/p/18133997