write a c++ code of diagonal matrix.
Answers were Sorted based on User's Feedback
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 |
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 |
Which is the best institute in hyderabad for C/C++ and it also has fast track course structure.
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
Child cObj = new Parent() Wahts the output ?
Can we have a private constructor ?
12 Answers HSBC, Ness Technologies, TCS, Wipro,
Why is polymorphism needed?
What causes polymorphism?
namespace is working on which compiler?
Describe these concepts: Polymorphism, Inheritance and Abstraction.
class type to basic type conversion
write a c++ program to find maximum of two numbers using inline functions.
What are different types of JVM's? for example we use dalvik jvm for android then what about the remaining operating systems?
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?