1、1.输入两个正整数,m 和 n,求其最大公约数和最小公倍数。#includevoid main()int hcf(int,int); /*函数声明*/int lcd(int,int,int); /*函数声明*/int u,v,h,l;printf(“Please two numbers:n“);scanf(“%d,%d“,h=hcf(u,v);printf(“H.C.F=%dn“,h);l=lcd(u,v,h);printf(“L.C.D=%dn“,l);int hcf(int u,int v)int t,r;if(vu)t=u;u=v;v=t;while(r=u%v)!=0)u=v;v=r;
2、return(v);int lcd(int u,int v,int h)return(u*v/h);2.输入一行字符,分别统计出其中字母、空格、数字和其他字符的个数。#includeint letter,digit,space,others;void main()void count(char);char text80;printf(“Please string:n“);gets(text);printf(“string:n“);puts(text);letter=0;digit=0;space=0;others=0;count(text);printf(“letter:%d,digit:%d
3、,space:%d,others:%dn“,letter,digit,space,others);void count(char str)int i;for(i=0;stri!=0;i+)if(stri=avoid main()void count(char);char text80;printf(“Please numbers:n“);gets(text);printf(“Numbers:n“);puts(text);digit=0;count(text);printf(“digit:%dn“,digit);void count(char str)int i;for(i=0;stri!=0;
4、i+)if(stri=0void main()unsigned long iNumber;printf(“Please a number:n“);scanf(“%ld“,printf(“The number is:%ldn“,iNumber);printf(“The inverse number is:“);invertLongInt(iNumber);void invertLongInt(long x)if(x=0int n;for(n=1;nvoid main()int i,j;printf(“The picture is:n“);static char picture47= , , ,*
5、, , ,*,*,*, , *,*,*,*,*,*,*,*,*,*,*,*;for(i=0;ivoid main()int i,j;printf(“The picture is:n“);char picture44=*,*,*, *,*,*,*,*,*,*;for(i=0;ivoid main()float sum=1.0,t,s=1;int i;for(i=1;ivoid main()int i,j,k,n;printf(“100999 之间的所有水仙花数 are:n“);for(n=100;nvoid main()int a,n,i=1,sn=0,tn=0;printf(“a,n=:“);
6、scanf(“%d,%d“,while(ivoid main()char a7=*,*,*,*,*,*,*;int i,j,k;char space= ;printf(“The picture is:“);for(i=0;i#define N 4struct studentchar num3;char name4;float score2;float avr;stuN;void main()int i,j;float sum,average;for(i=0;ivoid main()char a5=*,*,*,*,*;int i,j,k;char space= ;printf(“The pict
7、ure is:“);for(i=0;ivoid main()int sum_day(int,int);int leap(int year);int year,month,day,days;printf(“ date(year,month,day):“);scanf(“%d,%d,%d“,printf(“%d/%d/%d“,year,month,day);days=sum_day(month,day);if(leap(year)printf(“is the %dth day in this year.n“,days);int sum_day(int month,int day)int day_t
8、ab13=0,31,28,31,30,31,30,31,31,30,31,30,31;int i;for(i=1;ivoid main() float a33,sum=0; int i,j; printf(“请输入元素:n“); for(i=0;ivoid main() int a43,s4,i,j,k; for(i=0;ivoid main() int a43,s4,i,j,k; for(i=0;ivoid main() int a35,s3,i,j,k; for(i=0;ivoid main() int a43,s4,i,j,k; for(i=0;i #define N 10#define M 10void main()