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

Under Sher Shah the largest administrative unit was administrated by a chief namely 

A) Shikadar B) Mansabdar
C) Kasi D) Faujdar
 
Answer & Explanation Answer: A) Shikadar

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: Indian History

5 4063
Q:

In a vacuum, all electromagnetic waves have the same

A) Velocity B) Wavelenth
C) Frequency D) All the above
 
Answer & Explanation Answer: A) Velocity

Explanation:

When traveling in a vacuum, electronic waves from the electromagnetic spectrum all travel at the same speed. Velocity is speed with direction, so they would all travel at the same velocity, realtively speaking. But frequency and wavelength are quite different.

Report Error

View Answer Report Error Discuss

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

8 4063
Q:

India was partitioned as a consequence of the formula contained in 

A) Cabinet Mission Plan B) Attlee's Declaration
C) June 3 plan or Mountbatten plan D) Both (b) and (c)
 
Answer & Explanation Answer: C) June 3 plan or Mountbatten plan

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: Indian History

2 4062
Q:

Famous play ' Macbeth ' is written by

A) Leo Tolstoy B) William Shakespeare
C) john Milton D) Charles Dickens
 
Answer & Explanation Answer: B) William Shakespeare

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: Books and Authors

6 4062
Q:

I have four fingers and a thumb, but not alive.

Who am I?

Answer

A glove. It has 5 fingers as we have but not alive.

Report Error

View answer Workspace Report Error Discuss

Subject: Logic Puzzles Exam Prep: GATE , CAT , Bank Exams , AIEEE
Job Role: Bank PO , Bank Clerk , Analyst

2 4062
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 4061
Q:

Name an animal that has eyes yet sightless?

Answer

Bats

Report Error

View answer Workspace Report Error Discuss

33 4060