answersLogoWhite

0

AllQ&AStudy Guides
Best answer

#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();

}

This answer is:
Related answers

#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();

}

View page

#include<stdio.h>

int main()

{

double matrix[10][10],a,b, temp[10];

int i, j, k, n;

printf("Enter the no of variables: ");

scanf("%d", &n);

printf("Enter the agumented matrix:\n");

for(i = 0; i < n ; i++){

for(j = 0; j < (n+1); j++){

scanf("%lf", &matrix[i][j]);

}

}

for(i = 0; i < n; i++){

for(j = 0; j < n; j++){

if(j>i){

a = matrix[j][i];

b = matrix[i][i];

for(k = 0; k < n+1; k++){

matrix[j][k] = matrix[j][k] - (a/b) * matrix[i][k];

}

}

}

}

printf("The Upper triangular matrix is: \n");

for( i = 0; i < n; i++){

for(j = 0; j < n+1; j++){

printf("%.2f", matrix[i][j]);

printf("\t");

}

printf("\n");

}

printf("\nThe required result is: ");

for(i = n-1; i>=0; i--){

b = matrix[i][n];

for(j = n-1 ; j > i; j--){

b -= temp[n-j]*matrix[i][j];

}

temp[n-i] = b/matrix[i][i];

printf("\n%c => %.2f",97+i, temp[n-i]);

}

}

View page

There are no words that start with the letter N and have a QU in it. There are not many words that do have a QU in them. When QU is in a word, it is more commonly at the beginning.

View page

#include<stdio.h>

void transpose(int a[50][50]);

void main()

{

int a[50][50],b[50][50],m,n,i,j;

scanf("%d",&m,&n);

for(i=0;i<m;i++)

{

for(j=0;j<n;j++)

{

scanf("%d",&a[i][j]);

}

}

for(i=0;i<n;i++)

{

for(j=0;j<m;j++)

{

scanf("%d",&b[i][j]);

}

}

transpose(a,b,m,n)

void transpose(int a[50][50],int b[50][50],int m,int n)

{

int i;

for(i=0;i<m;i++)

{

for(j=0;j<n;j++)

{

b[i][j]=a[i][j];

}

}

}

View page

#include<stdio.h>

int main()

{

int n,i,j,k,a[10][10];

printf("\nEnter the number of nodes: ");

scanf("%d",&n);

for(i=0; i<n; i++)

{

for(j=0; j<n; j++)

{

printf("\nEnter the distance between the host %d%d:", i+1,j+1);

scanf("%d",&a[i][j]);

}

}

for(i=0; i<n; i++)

{

for(j=0; j<n; j++)

printf("%d\t",a[i][j]);

printf("\n");

}

for(k=0; k<n; k++)

{

for(i=0; i<n; i++)

{

for(j=0; j<n; j++)

{

if(a[i][j]>a[i][k]+a[k][j])

a[i][j]=a[i][k]+a[k][j];

}

}

}

for(i=0; i<n; i++)

{

for(j=0; j<n; j++)

{

b[i][j]=a[i][j];

if(i==j)

b[i][j]=0;

}

}

printf("\nThe output matrix is:\n");

for(i=0;i<n;i++)

{

for(j=0;j<n;j++)

printf("%d\t",b[i][j]);

printf("\n");

}

return 0;

}

View page
Featured study guide
📓
See all Study Guides
✍️
Create a Study Guide
Search results