Assigment 3
Assigment 3
Assigment 3
h>
#include <stdlib.h>
#define ROWS 5
#define COLS 5
int main(){
FILE *fptr1;
float a1[ROWS][COLS],j,n;
fptr1=fopen("array1.tex","r");
if(fptr1==NULL){printf("file not opened...");return 0;}
readArray(fptr1, a1);
printArray(a1);
printf("Multiplication Factor:\n");
uptrai(a1);
printf("\n");
printf("Lower Triangular Matrix:\n");
printArray(a1);
return 0;
}
void readArray(FILE* fptr, float a[ROWS][COLS]){
int i,j;
float k[COLS];
for(i=0;i<ROWS;++i){
for(j=0;j<COLS;++j){
fscanf(fptr,"%f ",&k[j]);
a[i][j]=k[j];
}
}
return;
}
void printArray(float a[ROWS][COLS]){
int j,i;
for(i=0;i<ROWS;++i){
for(j=0;j<COLS;++j){
printf("%f ",a[i][j]);
}
printf("\n");
}
return;
}