Questions

Q:

Write a program for matrix multiplication in c

Answer

#include <stdio.h>


int main() {


  int a[5][5], b[5][5], c[5][5], i, j, k, sum = 0, m, n, o, p;


  printf( "\nEnter the row and column of first matrix" );


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


  printf( "\nEnter the row and column of second matrix" );


  scanf( "%d %d", &o, &p );


  if(n!=o) {


      printf( "Matrix mutiplication is not possible" );


      printf( "\nColumn of first matrix must be same as row of second matrix" );


  }


  else {


      printf( "\nEnter the First matrix" );


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


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


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


      printf( "\nEnter the Second matrix" );


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


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


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


      printf( "\nThe First matrix is\n" );


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


      printf("\n");


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


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


      }


      }


      printf( "\nThe Second matrix is\n" );


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


      printf("\n");


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


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


      }       


      }


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


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


           c[i][j] = 0;


      for( i=0; i<m; i++ ) { //row of first matrix


      for( j=0; j<p; j++ )  {  //column of second matrix


           sum = 0;


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


               sum = sum + a[i][k]*b[k][j];


           c[i][j] = sum;


      }


      }


  }


  printf( "\nThe multiplication of two matrix is\n" );


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


      printf("\n");


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


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


      }


  }


  return 0;


}

Report Error

View answer Workspace Report Error Discuss

Subject: Programming

0 2329
Q:

In which country the hormone gibberellin was discovered?

A) India B) Japan
C) China D) Russia
 
Answer & Explanation Answer: B) Japan

Explanation:

The hormone gibberellin was discovered in the country Japan.

Report Error

View Answer Report Error Discuss

Filed Under: Inventions
Exam Prep: AIEEE , Bank Exams , CAT
Job Role: Analyst , Bank Clerk , Bank PO

0 2328
Q:

Which of the following represents a positive economic statement?

A) The government should extend unemployment benefits. B) The unemployment rate is too high.
C) Taxes should not be increased since that will lower spending. D) The unemployment rate is 4.8 percent.
 
Answer & Explanation Answer: D) The unemployment rate is 4.8 percent.

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: Indian Economy
Exam Prep: AIEEE , Bank Exams , CAT
Job Role: Analyst , Bank Clerk , Bank PO

2 2328
Q:

Evergreen trees lose their leaves steadily all year.

A) TRUE B) FALSE
Answer & Explanation Answer: A) TRUE

Explanation:

Trees that lose all of their leaves for part of the year are known as deciduous trees. Those that don't are called evergreen trees.

Report Error

View Answer Workspace Report Error Discuss

Subject: General Science
Exam Prep: AIEEE , Bank Exams
Job Role: Analyst , Bank Clerk

1 2328
Q:

The reverse effect of X-ray emission is

A) Raman effect B) Compton effect
C) Zeeman effect D) Photo-electric effect
 
Answer & Explanation Answer: D) Photo-electric effect

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: Physics
Exam Prep: Bank Exams

2 2328
Q:

Which is the 1st manned mission to International Space Station?

A) Ullas mission B) Narayan mission
C) Soyuz mission D) Crati mission
 
Answer & Explanation Answer: C) Soyuz mission

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: General Awareness
Exam Prep: AIEEE , Bank Exams , CAT
Job Role: Analyst , Bank Clerk , Bank PO

0 2327
Q:

Who is known as the father of Modern Chemistry?

A) Robert Boyle B) Antoine Lavoisier
C) John Dalton D) All of the above
 
Answer & Explanation Answer: D) All of the above

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: General Science
Exam Prep: AIEEE , Bank Exams , CAT
Job Role: Analyst , Bank Clerk , Bank PO

0 2327
Q:

'Agronomy' is the practice of raising ______________

A) Plants and Animals B) Crop plants
C) Agriculture D) Fruit plants only
 
Answer & Explanation Answer: A) Plants and Animals

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: General Awareness
Exam Prep: Bank Exams

1 2327