#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 sign;
while(scanf("%c",&sign)!=EOF)
{
getchar();
switch(sign)
{
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;
}
}
return 0;
}
#include<stdio.h>
#include<stdlib.h>
int main()
{
int gett,guss=rand()%32;
printf("Guess which day in May 2024 will be the start of your 1ucky day, you have three chances, guess (1~31):\n");
for(int i=3;i>0;i--)
{
if(i<3)
printf("Guess again (1-31):\n");
scanf("%d",&gett);
if(gett==guss)
{
printf("Wow, you got it :-)\n");
return 0;
}
else if(gett<guss)
printf("Your guess date is too early,your lucky day hasn't arrived yet. \n");
else
printf("Your guess date is too late,your lucky day is in front. \n");
}
printf("Run out of times. Please let me tell you that your lucky day in May is %d",guss);
return 0;
}
#include<stdio.h>
#include<stdlib.h>
double dou(int x,int y)
{
int sum=0;
for(int i=1;i<=x;i++)
sum=sum*10+y;
return sum;
}
int main()
{
int a,n;
double s;
while(scanf("%d%d",&n,&a)!=EOF)
{
s=0;
for(int i=1;i<=n;i++)
s=s+i/dou(i,a);
printf("n = %d,a = %d,s = %6lf",n,a,s);
}
return 0;
}
#include<stdio.h>
#include<stdlib.h>
int main()
{
for(int i=1;i<=9;i++)
{
for(int j=1;j<=i;j++)
printf("%dx%d = %d ",j,i,i*j);
printf("\n");
}
return 0;
}
#include<stdio.h>
#include<stdlib.h>
int main()
{
int n;
printf("input n:");
scanf("%d",&n);
for(int i=n;i>=1;i--)
{
for(int j=n-i;j>0;j--)
printf(" ");
for(int j=1;j<=2*i-1;j++)
printf(" O ");
printf("\n");
for(int j=n-i;j>0;j--)
printf(" ");
for(int j=1;j<=2*i-1;j++)
printf("<H> ");
printf("\n");
for(int j=n-i;j>0;j--)
printf(" ");
for(int j=1;j<=2*i-1;j++)
printf("I I ");
printf("\n");
}
return 0;
}