代码:
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <pthread.h>
#include <semaphore.h>
#include <stdlib.h>
int main(int argc, const char *argv[])
{
// 行列初始化
int n = 0, m = 0;
printf("请输入行:");
scanf("%d", &n);
printf("请输入列:");
scanf("%d", &m);
int A[n][m];
int X[n][m];
// 循环输入数组数据
for (int i = 0; i < n; i++)
{
for (int j = 0; j < m; j++)
{
printf("A[%d][%d]:", i, j);
scanf("%d", &A[i][j]);
}
}
for (int i = 0; i < n; i++)
{
for (int j = 0; j < m; j++)
{
printf("%d\t", A[i][j]);
}
printf("\n");
}
int sum;
for (int i = 0; i < n; i++)
{
for (int j = 0; j < m; j++)
{
sum = 1;
for (int row = 0; row < n; row++)
{
if (row != i)
{
//printf("row = %d i = %d\n", row, i);
sum *= A[row][j];
}
}
for (int line = 0; line < m; line++)
{
if (line != j)
{
sum *= A[i][line];
}
}
X[i][j] = sum;
printf("%d\t", sum);
}
printf("\n");
}
int max = 0;
for (int i = 0; i < n; i++)
{
for (int j = 0; j < m; j++)
{
if (i == 0 && j == 0)
{
max = X[i][j];
}
if (max < X[i][j])
{
max = X[i][j];
}
}
}
printf("最大值是:%d", max);
return 0;
}
结果:
2.有一个unsigned char类型的数据data,把他的第六个bit位置为1。请写出将 data第6位清0的表达式
答:表达式:data &= ~(1 << 5)
data |= (1<<5)