Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


write a c++ code of diagonal matrix.

Answers were Sorted based on User's Feedback



write a c++ code of diagonal matrix. ..

Answer / senthil.k,arasur

void main()
{
int a,b,c;
cout<<"Diagonal matrix";
for(a=1;a<=3;a++)
{
for(b=1;b<=3;b++)
{
c=1;
if(c==b)
{
cout<<c;
}
else
{
cout<<"0";
}
}
c++;
cout<<"\n";
}
}
output:

1 0 0
0 2 0
0 0 3

Is This Answer Correct ?    38 Yes 52 No

write a c++ code of diagonal matrix. ..

Answer / md.ekramul kabir

#include<stdio.h>


void main(void)
{
int row=0,column=0;

int data[4][4];

for(row=0;row<=3;row++)
{

for(column=0;column<=3;column++)
{

scanf("%d",&data[row][column]);
}
}



printf("\nYour Matrix is : \n");


for(row=0;row<=3;row++)
{

for(column=0;column<=3;column++)
{

printf("%d\t",data[row][column]);
}

printf("\n");
}

}

Is This Answer Correct ?    13 Yes 30 No

Post New Answer

More OOPS Interview Questions

what are the ways in which a constructors can be called?

2 Answers   TCS,


what is a virtual class?

5 Answers   Cap Gemini, IBM, Infosys, Trinity Technologies,


What is polymorphism explain its types?

0 Answers  


Should you protect the global data in threads? Why or why not?

2 Answers   IBM,


What is a class and object?

0 Answers  


Write a java applet that computes and displays the squares of values between 25 and 1 inclusive and displays them in a TextArea box

0 Answers  


What makes a language oop?

0 Answers  


4. What do you mean by a prototype? Define analysis prototype

1 Answers  


is there any choice in opting subjects like 4 out of 7

0 Answers  


what are the realtime excercises in C++?

0 Answers   IBM, Wipro,


what is the size of an empty class

12 Answers   Wipro,


what is the difference between ERROR and EXCEPTION?

14 Answers   NIIT, nvidia,


Categories