`#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;
}`
`#include<stdio.h>
include<stdlib.h>
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;
}`
`#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;
}
`
`#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;
}`