NOTHING!! its nasty on its own, so it twice as bad with a mix. plus it ruins what ever u mixed it with. you will nvr drink it again.
Chat with our AI personalities
J. B. Priestley was born on September 13, 1894.
#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; }