Questions

Q:

Write a c program to find out sum of diagonal element of a matrix.

Answer

#include<stdio.h>

int main(){

  int a[10][10],i,j,sum=0,m,n;

  printf("\nEnter the row and column of matrix: ");
  scanf("%d %d",&m,&n);

  printf("\nEnter the elements of matrix: ");
  for(i=0;i<m;i++)
      for(j=0;j<n;j++)
           scanf("%d",&a[i][j]);
  printf("\nThe matrix is\n");

  for(i=0;i<m;i++){
      printf("\n");
      for(j=0;j<m;j++){
      printf("%d\t",a[i][j]);
      }
 }
 for(i=0;i<m;i++){
     for(j=0;j<n;j++){
          if(i==j)
              sum=sum+a[i][j];
     }
 }
 printf("\n\nSum of the diagonal elements of a matrix is: %d",sum);

 return 0;
}

Sample output:

Enter the row and column of matrix: 3 3
Enter the elements of matrix:
2
3
5
6
7
9
2
6
7
The matrix is
2       3       5
6       7       9
2       6       7
Sum of the diagonal elements of a matrix is: 16

Report Error

View answer Workspace Report Error Discuss

Subject: Programming

1 4413
Q:

When is the ' World AIDS Day ' observed all over the world

A) 1st october B) 12th December
C) 1st December D) 13th November
 
Answer & Explanation Answer: C) 1st December

Explanation:
Report Error

View Answer Report Error Discuss

5 4413
Q:

Coir, Copra, Coconut , Cashew are mainly exported from

A) Mumbai B) Cochin
C) Tuticorin D) Chennai
 
Answer & Explanation Answer: B) Cochin

Explanation:

Because Kerala is the major producer of these products.

Report Error

View Answer Report Error Discuss

Filed Under: Indian Geography

9 4412
Q:

How many Teaspoons in a Tablespoon?

A) 4 B) 5
C) 2 D) 3
 
Answer & Explanation Answer: D) 3

Explanation:

Tablespoon > Teaspoon

In US & UK, 1 Tablespoon = 3 Teaspoons.

Report Error

View Answer Report Error Discuss

7 4412
Q:

Indus Valley Civilization is called the protohistoric civilization because its people knew 

A) art B) writing
C) copper D) pottery
 
Answer & Explanation Answer: B) writing

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: General Awareness

1 4412
Q:

Math Logic Challenge

18582095_1309614185812349_1823149961450714717_n1499156071.jpg image

A) 23 B) 26
C) 13 D) 29
 
Answer & Explanation Answer: B) 26

Explanation:

Let the integer be x. Then,

 x2-20x = 156

 

(x + 6)(x - 26) = 0

 

x = 26

 

The integer is 26.

Report Error

View Answer Report Error Discuss

Filed Under: Math Puzzles
Exam Prep: GATE , CAT , Bank Exams , AIEEE
Job Role: Bank PO , Bank Clerk

12 4411
Q:

Clay is an example of

A) Aquiclude B) Glossy
C) Utilitarian D) None of the above
 
Answer & Explanation Answer: A) Aquiclude

Explanation:

Clay is an example of Aquiclude.

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 4410
Q:

Which of the following countries is a permanent member of the UN Security Council?

A) Switzerland B) People's Republic of china
C) Japan D) Ukraine
 
Answer & Explanation Answer: B) People's Republic of china

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: General Awareness

2 4410