//產生 100~200的隨機數#include <stdio.h>#include <stdlib.h>int min;int find(){ int i, y, x,max; x = rand()%101 + 100; max = x; min = x; printf("產生的隨機數為:\n%d\n",x); for(i =0;i<9;i++){ y = rand()%101 + 100; printf("%d\t\n",y); if(y>max) max = y; if(y<min) min = y; } return max;}void main(){ int max = find(); printf("最大數為%d ,最小數為%d",max,min);} //靜態變數求1~5的階層#include <stdio.h>#include <stdlib.h>int fac(int n){ static int f = 1; f *= n; return f;}void main(){ int k; for(k=1;k<=5;k++){ printf("%d! = %d\n",k,fac(k)); }} //判斷為該年第幾天#include <stdio.h>int days(int year,int month,int day){ int i,count=0,monthArr[] = {31,28,31,30,31,30,31,31,90,31,30,31}; if( ((year%100)&&!(year%4)) || !(year%400) ) monthArr[1] = 29; for(i=0;i<month-1;i++){ count += monthArr[i]; } count += day; return count;}void main(){ int year,month,day; printf("請依次輸入年、月、日\n"); scanf("%d,%d,%d",&year,&month,&day); printf("%d年%d月%d日為該年的第%d天",year,month,day,days(year,month,day));}