#include<stdio.h>
int main()
{
int i,j,sum=0;
int a[3][3]={{1,2,3},{4,5,6},{7,8,9}};
for(i=0;i<3;i++)
for(j=0;j<3;j++)
if(i==j)
sum=sum+a[i][j];
printf("a:\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
printf("%d",a[i][j]);
printf("\n");
}
printf("sum is %d\n",sum);
return 0;
}
#include<stdio.h>
int main()
{
int t[15]={15,14,13,12,11,10,9,8,7,6,5,4,3,2,1};
int a,b,c,mid;
int i;
a=0;b=14;
printf("the array is:\n");
for(i=0;i<15;i++)
printf("%d",t[i]);
printf("\n");
printf("please input the number:");
scanf("%d",&c);
while(a<=b)
{
mid=(a+b)/2;
if(c==t[...
#include<stdio.h>
int main()
{
char a[30]="I am a boy.",b[]="I am a student.";
int i=0,j;
j=strlen(a);
printf("a is:%s\n",a);
printf("b is:%s\n",b);
while(b[i]!='\0')
{
a[j]=b[i];
i++;
j++;
}
a[j]='\0';
printf("%s\n",a);
return 0;
}