#include<stdio.h> void main() { int a[5],b[5]; int c[10]; int i,j,temp,k; printf("\n enter the elements of array A:=\n"); for(i=0;i<5;i++) scanf("%d",&a[i]); printf("\n enter the elements of array B:=\n"); for(i=0;i<5;i++) scanf("%d",&b[i]); for(i=1;i<5;i++) { for(j=0;j<5-i;j++) { if(a[j]>a[j+1]) { temp=a[j]; a[j]=a[j+1]; a[j+1]=temp; } } for(j=0;j<5-i;j++) { if(b[j]>b[j+1]) { temp=b[j]; b[j]=b[j+1]; b[j+1]=temp; } } } printf("\n the elements of the array A:=\n"); for(i=0;i<5;i++) printf("%d\t",a[i]); printf("\n the elements of the array B:=\n"); for(i=0;i<5;i++) printf("%d\t",b[i]); i=0,j=0,k=0; while(i<5&&j<5) { if(a[i]>b[j]) c[k++]=b[j++]; if(a[i]<b[j]) c[k++]=a[i++]; } if(i<5&&j==5) while(i<5) c[k++]=a[i++]; if(i==5&&j<5) while(j<5) c[k++]=b[j++]; printf("\n the elements of the sorted merged array C:=\n"); for(i=0;i<10;i++) printf("%d\t",c[i]); }
#include <stdio.h> #include <conio.h> void main(){ int a[10],b[10],c[10],i,j,m,n,tmp,k; printf("\nEnter the size of the 1st array:"); scanf("%d",&m); printf("\nEnter the size of the 2nd array:"); scanf("%d",&n); printf("\nEnter the 1st array values:"); for(i=0;i<m;i++){ scanf("%d",&a[i]); } printf("\nEnter the 2nd array values:"); for(i=0;i<n;i++){ scanf("%d",&b[i]); } for(i=0;i<m;i++) { for(j=0;j<m-i;j++) { if(a[j]>a[j+1]) { tmp=a[j]; a[j]=a[j+1]; a[j+1]=tmp; } } } printf("\n\n Array in the ascending order is - \n"); for(i=0;i<m;i++) { printf("\t %d",a[i]); } for(i=0;i<n;i++) { for(j=0;j<n-i;j++) { if(b[j]>b[j+1]) { tmp=b[j]; b[j]=b[j+1]; b[j+1]=tmp; } } } printf("\n\n Array in the ascending order is - \n"); for(i=0;i<n;i++) { printf("\t %d",b[i]); } i=j=k=0; while(i<n&&j<m) { if(a[i]<b[j]) c[k++]=a[i++]; else if(a[i]>b[j]) c[k++]=b[j++]; else { c[k++]=b[j++]; i++; j++; } } if(i<n) { int t; for(t=0;t<n;t++) c[k++]=a[i++]; } if(j<m) { int t; for(t=0;t<m;t++) { c[k++]=b[j++]; } } printf("\nFinally sorted join array is:"); for(k=0;k<(m+n);k++) printf("\t\n %d ",c[k]); getch(); }
its simple just do this swappping for(i=0;i<m;i++) /*A*/ for(j=0;j<i;j++) /*B*/ { x=a[i][j]; a[i][j]=a[j][i]; a[j][i]=x; } I think A and B need a change : /*Permutation : */ for ( i = 0 ; i <= lig ; i++ ) /*A*/ for ( j = 0 ; j <= i ; j++ ) /*B*/ { int permut = MatA[i][j] ; MatA[i][j] = MatA[j][i] ; MatA[j][i] = permut ; } /*End of permutation */ printf("\nDISPLAY MATRIX : \n") ; for ( i = 0 ; i < col ; i++ ) { for ( j = 0 ; j < lig ; j++ ) { printf("%d", MatA[i][j]) ; } printf("\n") ; }
void main() { int array[10]; int i, j, N, temp; int findmax(int b[10], int k); /* function declaration */ void exchang(int b[10], int k); clrscr(); printf("Enter the value of N\n"); scanf("%d",&N); printf("Enter the elements one by one\n"); for(i=0; i { scanf("%d",&array[i]); } printf("Input array elements\n"); for(i=0; i { printf("%d\n",array[i]); } /* Selection sorting begins */ exchang(array,N); printf("Sorted array is...\n"); for(i=0; i< N ; i++) { printf("%d\n",array[i]); } } /* End of main*/ /* function to find the maximum value */ int findmax(int b[10], int k) { int max=0,j; for(j = 1; j <= k; j++) { if ( b[j] > b[max]) { max = j; } } return(max); } void exchang(int b[10],int k) { int temp, big, j; for ( j=k-1; j>=1; j--) { big = findmax(b,j); temp = b[big]; b[big] = b[j]; b[j] = temp; } return; }
#include<iostream.h> #include<conio.h> void main() { clrscr(); int a[10][10],b[10][10],c[10][10],m,n,i,j; cout<<"Enter number of rows: "; cin>>m; cout<<"Enter number of coloumns: "; cin>>n; cout<<endl<<"Enter elements of matrix A: "<<endl; for(i=0;i<m;i++) { for(j=0;j<n;j++) { cout<<"Enter element a"<<i+1<<j+1<<": "; cin>>a[i][j]; } } cout<<endl<<"Enter elements of matrix B: "<<endl; for(i=0;i<m;i++) { for(j=0;j<n;j++) { cout<<"Enter element b"<<i+1<<j+1<<": "; cin>>b[i][j]; } } cout<<endl<<"Displaying Matrix A: "<<endl<<endl; for(i=0;i<m;i++) { for(j=0;j<n;j++) { cout<<a[i][j]<<" "; } cout<<endl<<endl; } cout<<endl<<"Displaying Matrix B: "<<endl<<endl; for(i=0;i<m;i++) { for(j=0;j<n;j++) { cout<<b[i][j]<<" "; } cout<<endl<<endl; } cout<<endl<<"Matrix A + Matrix B = Matrix C: "<<endl<<endl; for(i=0;i<m;i++) { for(j=0;j<n;j++) { cout<<a[i][j]+b[i][j]<<" "; } cout<<endl<<endl; } getch(); }
J. B. Priestley was born on September 13, 1894.
Yes. J. B. Priestley was a novelist.
J. B. Priestley was born on September 13, 1894 and died on August 14, 1984. J. B. Priestley would have been 89 years old at the time of death or 120 years old today.
J. B. Priestley died on August 14, 1984 at the age of 89.
J. B. Priestley died on August 14, 1984 at the age of 89.
Alexander coolblayley
Although it is set in 1912, Priestley wrote the play in 1945
John Boynton "J. B." Priestley, OM, was an English novelist, playwright, scriptwriter, social commentator, and broadcaster.
'An Inspector Calls' was written by J B Priestley.
Ladislaus Lo b has written: 'Mensch und Gesellschaft bei J. B. Priestley'
Published 1943 by Collins Publishers
B. J. Edwards was born in 1838.