/T29/
#include<stdio.h>
#include<stdlib.h>int main()
{
srand(5);
int i,n;
int a[10000];
int b[10001];
for(i=0;i<10000;i++)
{
n=rand();
a[i]=n;
}
for(i=0;i<10000;i++)
b[i+1]=a[i];
printf("%d\n",b[3456]);
return 0;
}
/T30/
#include<stdio.h>
int main()
{
double fun(double m,double n,double S1,double S2);
double m,n,S1,S2;char ch;
do
{
printf("请输入行号和列号:");
scanf("%lf%lf",&m,&n);
S1=m-1;
S2=m-n;
printf("第%.0lf行第%.0lf列的数是:%.0lf\n",m,n,fun(m,n,S1,S2));
printf("是否继续?[y/n][y]");
while((ch=getchar())!='\n');
}while((ch=getchar())=='y'||ch=='\n');
return 0;
}
double fun(double m,double n,double S1,double S2)
{
double i;
for(i=m-2;i>=1;i--)
S1=S1*i;
for(i=m-n-1;i>=1;i--)
S2=S2*i;
return S1/S2;
}
/T32/
#include<stdio.h>
int main()
{
int i,j,p,a[100];
for(i=0;i<=56;i++)
a[i]=i+1;
for(p=i=j=0;p!=56;)
{
if(a[i]!=0)
j++;
if(j==4)
{
j=0;
a[i]=0;
p++;
}
i++;
if(i==57)
i=0;
}
for(i=0;i<57;i++)
{
if(a[i]!=0)
printf("%d号?\n",a[i]);
}
return 0;
}
/T36/
#include<stdio.h>
int main()
{
void printdate(int year,int month,int day);
int year,month,day;
printf("please enter datas:");
scanf("%d%d%d",&year,&month,&day);
printdate(year,month,day);
printf(" %d %d",day,year);
printf("\n");
return 0;
}
void printdate(int year,int month,int day)
{
switch(month)
{
case 1:printf("January");break;
case 2:printf("February");break;
case 3:printf("March");break;
case 4:printf("April");break;
case 5:printf("May");break;
case 6:printf("June");break;
case 7:printf("July");break;
case 8:printf("August");break;
case 9:printf("September");break;
case 10:printf("October");break;
case 11:printf("November");break;
case 12:printf("December");break;
default:printf("Êý¾ÝÓдíÎó£¬ÇëÖØÐÂÊäÈ룺");
}
}
/T38/
#include<stdio.h>
int main()
{
int powers(int m,int n);
int sum_of_powers(int k,int n);
int a,b;
while(1)
{
scanf("%d%d",&a,&b);
printf("sum of %d powers of intergers from 1 to %d =%d\n",a,b,sum_of_powers(a,b));
}
return 0;
}
int powers(int m,int n)
{
int i,sum=1;
for (i=0;i<n;i++)
{
sum*=m;
}
return sum;
}
int sum_of_powers(int k,int n)
{
int i,sum=0;
for(i=1;i<=n;i++)
sum=sum+powers(i,k);
return sum;
}