사용자에게 매트릭스 입력을 요청하는 코드 부분을 게시하고 있지만 표시하는 동안 요소로 0.000000 만 표시합니다. 내가 올바른 일을하지 않는 곳을 찾으러 오십시오.사용자로부터 입력을받는 동안 C 프로그램의 출력이 0이됩니다.
#include<stdio.h>
main(){
int i,j,m,x,c,l;
double mat[100][100],temp[100],a[100][100],lt[100][100]={0.000},ut[100][100],maximum,per[100][100];
printf("Enter the size of square matrix: ");
scanf("%d", &m);
//enter the matrix
for(i=0;i<m;i++)
{
printf("enter the row %d: \n", i+1);
for(j=0;j<m;j++){
scanf("%f",&mat[i][j]);
a[i][j]=mat[i][j];
}
}
//show matrix
printf("matrix =\n");
for(i=0;i<m;i++)
{
for(j=0;j<m;j++)
{
printf("%f\t", mat[i][j]);
}
printf("\n");
}
컴파일러 경고를 켜면'double'을 스캔하기 위해'scanf '에'% lf'가 필요하다는 것을 알게 될 것입니다. (그러나 _printing_에 대한'% f'는'double'입니다.) –
감사합니다. 문제가 해결되었습니다. –