write the code that display the format just like
1
2 1
3 2 1
4 3 2 1
5 4 3 2 1
6 5 4 3 2 1

Answers were Sorted based on User's Feedback



write the code that display the format just like 1 2 1 3 2 1 4 3 2 1 5 4 3 2 1 6 5 4 3 2 1 ..

Answer / prasenjit roy

int main()
{
int i;
int j;
for(i = 1; i <= 6; i++)
{
for(j = i; j >= 1; j--)
cout<<j<<" ";
cout<<endl;
}
return 0;
}

Is This Answer Correct ?    4 Yes 0 No

write the code that display the format just like 1 2 1 3 2 1 4 3 2 1 5 4 3 2 1 6 5 4 3 2 1 ..

Answer / bhushan

#include<iostream.h>
void main()
{
for(int i=1;i<=6;i++)
{
for(int j=i;j>=1;j--)
{
cout<<j<<"\t";
}
cout<<"\n";
}
}

Is This Answer Correct ?    1 Yes 0 No

write the code that display the format just like 1 2 1 3 2 1 4 3 2 1 5 4 3 2 1 6 5 4 3 2 1 ..

Answer / gayatri chhotray

int main()
{
int i;
int j;
for(i = 1; i <= 6; i++)
{
for(j = i; j >= 1; j--)
{

cout<<j<<" ";
}
}
return 0;
}

Is This Answer Correct ?    4 Yes 4 No

write the code that display the format just like 1 2 1 3 2 1 4 3 2 1 5 4 3 2 1 6 5 4 3 2 1 ..

Answer / suman_kotte

main()
{
int i,j;
for(i=1;i<=6;i++)
{
for(j=i;j>=1;j--)
printf("%d",j);
printf("\n");
}
}

Is This Answer Correct ?    1 Yes 1 No

write the code that display the format just like 1 2 1 3 2 1 4 3 2 1 5 4 3 2 1 6 5 4 3 2 1 ..

Answer / kamal

int main()
{
cout<<"1\n2 1\n3 2 1\n4 3 2 1\n5 4 3 2 1\n6 5 4 3 2 1";
return 0;
}

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ General Interview Questions

Describe about storage allocation and scope of global, extern, static, local and register variables?

0 Answers  


How can I learn dev c++ programming?

0 Answers  


Differentiate between an array and a list?

0 Answers  


Can we get the value of ios format flags?

0 Answers  


How const int *ourpointer differs from int const *ourpointer?

0 Answers  






Can constructor be static in c++?

0 Answers  


Explain what is polymorphism in c++?

0 Answers  


How size of a class can be calulated?

2 Answers  


sir there is some problem with nokia5130c-2,when we are trying to upload movies from net then there is a error occurred"FORMAT NOT SUPPORTED" bt its all ready in 3gp format.please tell me what i do now?

2 Answers   Nokia,


What is == in programming?

0 Answers  


Which is most difficult programming language?

0 Answers  


What are put and get pointers?

0 Answers  


Categories