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 |
What is the purpose of polymorphism?
What is advantage of inheritance?
What are different oops concepts?
What's the full form of STL?
What are two types of polymorphism?
I hv a same function name,arguments in both base class and dervied class, but the return type is different. Can we call this as a function overloading? Explain?
Write pseudo code for push in a stack?
How do you explain polymorphism?
is there any choice in opting subjects like 4 out of 7
i^=j; j^=i; i^=j; value of i,j
What is a friend function & its advantage?
Will I be able to get a picture in D drive to the c++ program? If so, help me out?