Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Project 4 v.5
//gcc 5.4.0 #include <stdio.h> int FindMax(int A[3][3]){ int MaxVal=A[0][0]; int x,y,n=3; for(x=0;x<n;x++) for(y=0;y<n;y++){ if(A[x][y]>MaxVal) MaxVal=A[x][y]; // printf("%d\n",MaxVal); } return(MaxVal); } int FindMin(int A[3][3]){ int MinVal=A[0][0]; int x,y,n=3; for(x=0;x<n;x++) for(y=0;y<n;y++){ if(A[x][y]<MinVal) MinVal=A[x][y]; // printf("%d\n",MinVal); } return(MinVal); } int FindColumnSum(int A[3][3],int y){ int x,sum=0,n=3; for(x=0;x<n;x++){ sum=sum+A[x][y]; // printf("%d\n",sum); } return(sum); } int FindRowSum(int A[3][3],int x){ int y,sum=0,n=3; for(y=0;y<n;y++){ sum=sum+A[x][y]; // printf("%d\n",sum); } return(sum); } double FindArrayMean(int A[3][3]){ int x,y,sum=0,n=3,m1=0; double mean=0; for(x=0;x<n;x++) for(y=0;y<n;y++){ sum=sum+A[x][y]; // printf("%d\n",sum); m1++; } mean=sum/m1; return(mean); } //int ColumnZeroAss(int A[3][3],int Cz[9]){ // } //int RowZeroAss(intA[3][3],int Rz[9]){ // } int CheckIdentMatrix int main(void) { int A[3][3]={{1,2,3},{4,5,6},{7,8,9}}; // int Cz[9]; // int Rz[9]; int MaxVal; int x,y,n=3; printf("Maximum Value of the Array is %d\n",FindMax(A)); printf("Minimum Value of the Array is %d\n",FindMin(A)); for(y=0;y<n;y++){ printf("Column %d's sum=%d\n",y,FindColumnSum(A,y)); } for(x=0;x<n;x++){ printf("Row %d's sum=%d\n",x,FindRowSum(A,x)); } printf("Array A's Average= %lf\n",FindArrayMean(A)); }
run
|
edit
|
history
|
help
0
pth_trap.c
Threads_posix
2-D array
FILE Access 2
garbage
String Manipulation
Refcount220323
Basic String Compression in C
18BCE2182 ASSESS_1 Q1-5
Spring 2017 Project 2 v1.5