#include<stdio.h> #include<conio.h> main() { int a[4][4],b[4][4],c[4][4],i,j; printf("enter the elements of matrix a"); for(i=0;i<=3;i++) for(j=0;j<=3;j++) scanf("%d",&a[i][j]); printf("the first matris is"); for(i=0;i<=3;i++) { printf("\n"); for(j=0;j<=3;j++) printf("%d",a[i][j]); } printf("Enter the elements of second matrix"); for(i=0;i<=3;i++) for(j=0;j<=3;j++) scanf("%d",&b[i][j]); printf("the second matrix is"); for(i=0;i<=3;i++) { printf("\n"); for(j=0;j<=3;j++) printf("%d",b[i][j]); } for(i=0;i<=4;i++) for(j=0;j<=4;j++) c[i][j]=a[i][j] + b[i][j]; printf("the addition of matrix is"); for(i=0;i<=3;i++) { for(j=0;j<=3;j++) printf("%d\t",c[i][j]); printf("\n"); } getch(); }
/* multiplication of a 3*3 matrix*/ #include<stdio.h> main() { int a[3][3],b[3][3],c[3][3]; int i,j,k; printf("enter the elements in A matrix:\n"); for(i=0;i<=2;i++) { for(j=0;j<=2;j++) { scanf("%d",&a[i][j]); } } printf("enter b matrix:\n"); for(i=0;i<=2;i++) { for(j=0;j<=2;j++) { scanf("%d",&b[i][j]); } } for(i=0;i<=2;i++) { printf("\n"); for(j=0;j<=2;j++) { c[i][j]=0; for(k=0;k<=2;k++) { c[i][j] = c[i][j]+a[i][k] * b[k][j]; } } } printf("multiplication matrix is:\n"); for(i=0;i<=2;i++) { for(j=0;j<=2;j++) { printf("%d\t",c[i][j]); } printf("\n"); } }
#include<stdio.h> int main(){ int a[3][3],b[3][3],c[3][3],i,j; printf("Enter the First matrix->"); for(i=0;i<3;i++) for(j=0;j<3;j++) scanf("%d",&a[i][j]); printf("\nEnter the Second matrix->"); for(i=0;i<3;i++) for(j=0;j<3;j++) scanf("%d",&b[i][j]); printf("\nThe First matrix is\n"); for(i=0;i<3;i++){ printf("\n"); for(j=0;j<3;j++) printf("%d\t",a[i][j]); } printf("\nThe Second matrix is\n"); for(i=0;i<3;i++){ printf("\n"); for(j=0;j<3;j++) printf("%d\t",b[i][j]); } for(i=0;i<3;i++) for(j=0;j<3;j++) c[i][j]=a[i][j]+b[i][j]; printf("\nThe Addition of two matrix is\n"); for(i=0;i<3;i++){ printf("\n"); for(j=0;j<3;j++) printf("%d\t",c[i][j]); } return 0; }
#include<stdio.h> void main() { int a[3][3],b[3][3],c[3][3],i,j,k; clrscr(); printf("Enter elements of A:"); for(i=0;i<=2;i++) for(j=0;j<=2;j++) scanf("%d",&a[i][j]); printf("Enter elements of B:"); for(i=0;i<=2;i++) for(j=0;j<=2;j++) scanf("%d",&b[i][j]); printf("A:"); for(i=0;i<=2;i++) { for(j=0;j<=2;j++) printf("%d ",a[i][j]); printf(""); //To change line. } printf("B:"); for(i=0;i<=2;i++) { for(j=0;j<=2;j++) printf("%d ",b[i][j]); printf(""); } k=0; while(k<=2) { for(i=0;i<=2;i++) { int sum=0; for(j=0;j<=2;j++) sum=sum+a[i][j]*b[j][k]; c[i][k]=sum; } k++; } printf("Result: "); for(i=0;i<=2;i++) { for(j=0;j<=2;j++) printf("%d ",c[i][j]); printf(""); } getch(); }
The answer is 4! (4 factorial), the same as 4x3x2x1, which equals 24 combinations. The answer is 24 and this is how: A b c d A b d c A c d b A c b d A d c b A d b c B c d a B c a d B d a c B d c a B a c d B a d c C d a b C d b a C a b d C a d b C b d a C b a d D a b c D a c b D b c a D b a c D c a b D c b a
J. D. C. Bytco died in 1978.
J. C. D. Clark was born in 1951.
J. D. Hayworth is 53 years old (birthdate: July 12, 1958).
C. J. Chenier is 53 years old (birthdate: September 28, 1957).
D. J. C. Geldenhuys has written: 'Pennevis en Preller'
J. D. C. Wickham has written: 'Records by spade and terrier'
#include<stdio.h> #include<conio.h> void main() { int i,j,k,l,m; clrscr(); for(i=0;i<4;i++) { for(j=i+1;j<=4;j++) { printf("%d",j); } for(k=1;k<=i;k++) { printf("%d",k); } printf("\n"); for(k=i;k>=1;k--) { printf("%d",k); } for(j=4;j>=i+1;j--) { printf("%d",j); } getch(); }
did you mean 52C in a D? 52 cards in a deck.
C. D. J. Statham has written: 'Underground lighting in coal mines'
#include<stdio.h> #include<conio.h> main() { int a[10][10],b[10][10],c[10][10],m,n,i,j,p,q,op; printf("enter the order of matrix a:n"); scanf("%d",&m,&n); printf("enter the %d elements of a\n",m*); for(i=0;i<m;i++) for(j=0;j<n;j++) scanf("%d",&a[i][j]); printf("enter the order of matrix b:n"); scanf("%d",&p,&q); printf("enter the %d elements of b\n",p*q); for(i=0;i<p;i++) for(j=0;j<q;j++) scanf("%d",&b[i][j]); printf("enter the option\n"); scanf("%d",&option); switch(op) { case '+' : if(m==p&&n==q) printf("the resultant matrix c is:\n"); for(i=0;i<m;i++) for(j=0;j<n;j++) c[i][j]=a[i][j]+b[i][j]; printf("%d",c[i][j]); printf("\n"); break; case '/' : if(n==p) { for(i=0;i<m;;i++); {for(j=0;j<q;j++) {printf("%d",c[i][j]); } } c[i][j]=0; for(p=0;p<n;p++) c[i][j]=c[i][j]+a[i][p]*b[p][j]: } printf("resultant matrix is:\n"); for(i=0;i<m;;i++); {for(j=0;j<q;j++) {printf("%d\t",c[i][j]); } } printf("\n"); getch(); }
Sorry to delete the previous version of this program, but this one is much more concise and sophisticated. I have written this program for a 3*3 matrix, but if you want to change it, just enter additional variables to store the order of the matrix and then replace the "3"s of the program with them as needed. It's easy. So here we go:#include#includevoid swap(int *x,int *y);main(){int i,j,k,m,n;int matrix[3][3];printf("Enter the matrix: \n\n");for (i=0;i
#include<stdio.h> #include<conio.h> void main() { clrscr(); int i,j,m,a[20],b[20],c[20],max; printf("enter no of elements"); scanf("%d",&m); printf("enter elements"); for(i=0;i<=m;i++) { scanf("%d",&a[i]); } max=a[i]; for(i=0;i<=m;i++) { if(max<a[i]) { max=a[i]; } } for(i=0;i<=max;i++) { c[i]=0; } for(j=0;j<=m;j++) { c[a[j]]=c[a[j]]+1; } for(i=0;i<=max;i++) { c[i]=c[i]+c[i-1]; } for(j=m;j>=1;j--) { b[c[a[j]]]=a[j]; c[a[j]]=c[a[j]]-1; } printf("AFTER SORTING"); for(i=0;i<=m;i++) { printf("%d",b[i]); } getch(); }