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

'Pencillin' which is used as an antibiotic is obtained from 

A) Bacteria B) Fungi
C) Algae D) Lichens
 
Answer & Explanation Answer: B) Fungi

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: General Science

16 4118
Q:

The book “The Other One Percent: Indians in America” has been authored by whom?

A) Lionel Messi B) Balaji Vittal
C) Sanjoy Chakravorty D) Joe Harris
 
Answer & Explanation Answer: C) Sanjoy Chakravorty

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: General Awareness
Exam Prep: CAT
Job Role: Bank PO

6 4116
Q:

Number of moles of CO2 present in 24 grams of carbon is

A) 0.5 B) 1
C) 2 D) 0.25
 
Answer & Explanation Answer: C) 2

Explanation:

1 mole of CO2 contain 12gms of carbon and 44 gms of CO2

therefore  24 gms of carbon is present in 88 gms of CO2 or 2 moles of CO2

Report Error

View Answer Report Error Discuss

Filed Under: Chemistry

7 4116
Q:

Streptomycin was invented by

A) Fleming B) Marie Curie
C) Walksman D) None of these
 
Answer & Explanation Answer: C) Walksman

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: Inventions

1 4113
Q:

The only fil-maker to get Bharat Rartna was

A) Raj Kapoor B) Curies
C) Satyjit ray D) S.S.Vasan
 
Answer & Explanation Answer: C) Satyjit ray

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: Honours and Awards

1 4113
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 4112
Q:

Where does hydroelectric energy come from?

A) Air B) Water
C) Solar D) All of the above
 
Answer & Explanation Answer: B) Water

Explanation:

Hydroelectricity is electricity produced from hydropower i.e, water.

Where_does_hydroelectric_energy_come_from1536043070.jpg image

Report Error

View Answer Report Error Discuss

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

4 4111