#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);
}
return 0;
}
#include<stdio.h>
int main(){
char c;
while(scanf("%c",&c)!=EOF){
switch(c){
case 'r': printf("stop!\n");break;
case 'g': printf("go go go\n");break;
case 'y': printf("wait a minute\n");break;
default: printf("something must be wrong...\n");break;
}
c=getchar();
}
return 0;
}
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
int main(){
printf("猜猜2024年5月哪一天会是你的lucky day\n");
int number,i,x;
srand(time(0));
number=rand()%31 + 1;
printf("开始喽,你有三次机会,猜吧:");
for(i=1;i<=3;i++){
scanf("%d",&x);
if(x<number)
printf("你猜的日期早了,你的lucky day还没到呢\n");
if(x>number)
printf("你猜的日期晚了,你的lucky day在前面哦\n");
if(x==number){
printf("哇,猜中了:-)\n");
break;
}
if(i==3){
printf("次数用完啦。偷偷告诉你,5月你的lucky day是%d号",number);
break;
}
printf("再猜:");
}
return 0;
}
#include<stdio.h>
#include<stdlib.h>
int main()
{
int n,i,a,m;
double s;
while(scanf("%d%d",&n,&a)!=EOF)
{
for(i=1,m=0,s=0;i<=n;++i)
{
m=m*10+a;
s+=1.0*i/m;
}
printf("n=%d, a=%d, s=%lf",n,a,s);
}
system("pause");
return 0;
}
#include<stdio.h>
int main()
{
int line,column,x;
for(line=1;line<=9;line++){
for(column=1;column<=line;column++){
x=column*line;
printf("%dx%d= %d\t",column,line,x);
}
printf("\n");
}
return 0;
}
#include<stdio.h>
int main()
{
int i,j,n,k,m;
printf("input n:");
scanf("%d",&n);
for(i=n;i>=1;i--){
for(k=1;k<=3;k++){
for(j=1,m=i;j<=(2*n-1);j++,m++){
if(j>(n+i-1))
printf("\t");
else if(m<n)
printf("\t");
else if(k==1)
printf(" O \t");
else if(k==2)
printf("<H>\t");
else if(k==3)
printf("I I\t");
}
printf("\n");
}
printf("\n");
}
return 0;
}