K j equals j when K is 1 or j is 0.
Chat with our AI personalities
Some of ways to solve this problem is to use four nested loops for().Something like following:...const int limit = 1000;//some code herefor (int i(0); i
//the following code will help you to write the program for(i=n-1, j=0; i > 0; i--, j++) //n is the order of the square matrix { for(k=j; k < i; k++) printf("%d ", a[j][k]); for(k=j; k < i; k++) printf("%d ", a[k][i]); for(k=i; k > j; k--) printf("%d ", a[i][k]); for(k=i; k > j; k--) printf("%d ", a[k][j]); } m= (n-1)/2; //calculate the position of the middle element if (n% 2 == 1) printf("%d", a[m][m]);//to print the middle element also //9809752937(udanesh)
/*PROGRAM TO IMPLEMENT GAUSS-jordan method.#include#define MX 20main(){float a[MX] [MX+1],m,p;int i,j,k,n;puts("\n how many equations?:");scanf("%d",&n);for(i=0;i
k = you - int (you / j) * j; You can also use, if your language supports the modulus (%) operator... k = you % j;
#include<stdio.h> #include<conio.h> void main() { int a[10][10],i,j,k,m,n; printf("enter the order"); scanf("%d",&m,&n); for(i=0;i<m;i++) { for(j=0;j<n;j++) { scanf("%d",&a[i][j]); } } for(k=0;k<m;k++) { for(i=0;i<=m-1;i++) { for(j=0;j<n-i-1;j++) { if(a[k][j]>a[k][j+1]) temp=a[k][j]; a[k][j]=a[k][j+1]; a[k][j+1]=temp; } } } for(i=0;i<m;i++) { for(j=0;j<n;j++) { printf("sorted matrix=%d",a[i][j]); } } getch(); }