——————日历问题——————
#include
int xing(int year);
int run(int year);
int main()
{
int year;
int yue[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int xingqi[12];
int i,j,k;
printf("可以计算公元前的\n请输入年份:");
scanf("%d",&year);
year=year%400;
xingqi[0]=xing(year);
if((year%4==0&&year%100!=0)||year%400==0)
yue[1]=29;
for(i=1;i<12;i++)
xingqi[i]=(xingqi[i-1]+yue[i-1])%7;
for(i=0;i<12;i++)
{
printf(" ---------%d---------\n",i+1);
printf(" 日 一 二 三 四 五 六\n");
for(j=0;j
printf(" ");
j--;
for(k=0;k
{
j++;
if(j%7==0&&j>0)
printf("\n");
printf("%3d",k+1);
}
printf("\n");
printf("\n");
}
}
int run(int year)
{
if((year%4==0&&year%100!=0)||year%400==0)
return 1;
else return 0;
}
int xing(int year)
{
if(year==2008)
return 2;
else if(year>2008)
return (xing(year-1)+run(year-1)+365)%7;
else
return ((xing(year+1)-run(year)-365)%7+7)%7;
}
棗棗棗 ];j二 ———————
#include
void main()
{
int a[100][2]={0};
int i,j,n;
printf ("please input an intenger : \n");
scanf ("%d",&n);
while (n>100||n<=0)
{
printf ("Error input 0
scanf ("%d",&n);
}
printf ("please input %d numbers:\n",n);
for (i=0;i
{
scanf("%d", &a[i][0]);
}
for (i=0;i
for (j=0;j
{
if (a[i][0]>a[j][0])
a[i][1]++;
}
for (i=0;i
printf ("%d ",a[i][1]+1);
}
—————— 三 ——————
#include
#include
main()
{
int a[99]={0},b[99]={0},c[10000]={0};
char d[100]={0};
int i,j,m,n;
printf("请输入乘数:");
scanf("%s",d);
i=strlen(d);
m=i;
for(j=0;j
a[i-j-1]=d[j]-'0';
printf("请输入被乘数:");
scanf("%s",d);
i=strlen(d);
n=i;
for(j=0;j
b[i-j-1]=d[j]-'0';
for(i=0;i
for(j=0;j
c[i+j]=c[i+j]+a[i]*b[j];
for(i=0;i
{
if(c[i]>9)
{
c[i+1]=c[i]/10+c[i+1];
c[i]=c[i]%10;
}