#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(); }
for(j = 1; j <= 12; j++) { printf("\nEnter an integer value:"); scanf("%d",&x); if(x == 0) y(j) = 0; if(x != 0) y(j) = 10; }
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(); }
#include<stdio.h> #include<conio.h> void main() { clrscr(); int m[10][10]; int i,j,r,c; for (i=0;i<10;i++) { for (j=0;j<10;j++) { m[i][j]=0; } } printf("\n Enter size of row and colomn:"); scanf("%d %d",&r,&c); printf("\n Enter the two matrices: \n"); for (i=0;i<r;i++) { for (j=0;j<c;j++) { printf("Enter element %d %d of m1: ",(i+1),(j+1)); scanf("%d",&m[i][j]); } } printf("\n The matrix is: \n"); for (i=0;i<r;i++) { for (j=0;j<c;j++) { printf("%d ",m[i][j]); } printf("\n"); } printf("\n The transpose of the matrix is: \n"); for (i=0;i<r;i++) { for (j=0;j<c;j++) { printf("%d ",m[j][i]); } printf("\n"); } getch(); }
J. D. C. Bytco died in 1978.
J. C. D. Clark was born in 1951.
12 signs of the Zodiac 54 cards in a deck with the Joker
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(); }
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(); }
for(j = 1; j <= 12; j++) { printf("\nEnter an integer value:"); scanf("%d",&x); if(x == 0) y(j) = 0; if(x != 0) y(j) = 10; }
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(); }
Jesus had 12 Disciples