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

Which is the best institute in hyderabad for C/C++ and it also has fast track course structure.

13 Answers   Wipro,


should we use linear search or binary search if elements are placed in random order or mixed?in both cases? i need a little bit detail ans?thnks

2 Answers  


Child cObj = new Parent() Wahts the output ?

8 Answers   Patni, TCS,


Can we have a private constructor ?

12 Answers   HSBC, Ness Technologies, TCS, Wipro,


Why is polymorphism needed?

0 Answers  


What causes polymorphism?

0 Answers  


namespace is working on which compiler?

3 Answers  


Describe these concepts: Polymorphism, Inheritance and Abstraction.

0 Answers   TCS,


class type to basic type conversion

0 Answers  


write a c++ program to find maximum of two numbers using inline functions.

3 Answers   IBM,


What are different types of JVM's? for example we use dalvik jvm for android then what about the remaining operating systems?

0 Answers   IBM,


suppose A is a base class and B is the derved class. Both have a method foo which is defined as a virtual method in the base class. You have a pointer of classs B and you typecast it to A. Now when you call pointer->foo, which method gets called? The next part of the question is, how does the compiler know which method to call?

3 Answers   EA Electronic Arts,


Categories