void main()
{int a[3][4]={{1,2,3,4},{5,6,7,8},{9,10,11,12}}
int i,j,c,d,max
max=a[0][0]
for(i=0i<3i++)
{for(j=0j<4j++)
if(max<=a[i][j])
{max=a[i][j]
c=i
d=j
}
}
printf("%d最大数\n%d行号\n%d列号",max,c,d)
}
#include <stdio.h>int main(int argc, const char *argv[])
{
int i = 0, j = 0
int a[11] = {10,20,30,40,50,60,70,80,90,100}
int n = 0
int num = 10
int tmp = 0
printf("原有数组:\n")
for (i=0 i<num i++)
{
printf("%d ",a[i])
}
printf("\n")
printf("请输入要插入的数:\n")
scanf("%d",&n)
for (i=0 i<num i++)
{
if(n < a[i])
{
for (j = num j>i j--)
{
a[j] = a[j-1]
}
a[i] = n
break
}
}
printf("排好序后的新数组如下:\n")
for (i=0 i<num+1 i++)
{
printf("%d ",a[i])
}
printf("\n")
return 0
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)