write a program in c++ to generate imp

z y x w v w x y z
z y x w x y z
z y x y z
z y z
z

Answers were Sorted based on User's Feedback



write a program in c++ to generate imp z y x w v w x y z ..

Answer / gayatri chhotray

#include<iostream>
using namespace std;
int main()
{
int i;
int j;
int n = 118;
char c;
for(i = 1; i <= 5; i++)
{
for(j = 122; j >= n +(i-1); j--)
{
c = j;
cout<<c<<" ";
}
for(j=j+2; j<=122; j++)
{
c = j;
cout<<c<<" ";
}
cout<<endl;
}
return 0;
}

Is This Answer Correct ?    5 Yes 1 No

write a program in c++ to generate imp z y x w v w x y z ..

Answer / naman patidar

#include <iostream.h>

int main(){
char start ='z';
char end ='v';
int limit = start-end+1;

for(int i=0; i<limit; i++){
char ch = start+1;

for(int j=0; j<limit; j++){
if( j>=i ){
cout<<--ch<<"\t";
} else {
cout<<"\t";
}
}
for(int k=limit-1; k>i ; k--){
cout<<++ch<<"\t";
}
cout<<"\n\n";
}
return 0;
}

Is This Answer Correct ?    3 Yes 2 No

write a program in c++ to generate imp z y x w v w x y z ..

Answer / prasenjit roy

#include <iostream>
using namespace std;

#define START 'z'
#define END 'v'
#define LIMIT ( START - END + 1 )

int main(int argc, char* argv[])
{
int i,j;

for( i=0; i<LIMIT; i++){
char ch = START+1;

for( j=0; j<LIMIT; j++)
if( j>=i )
cout<<--ch<<" ";
else
cout<<" ";


for( j=LIMIT-1; j>i ; j--)
cout<<++ch<<" ";

cout<< endl;
}

return 0;
}

Is This Answer Correct ?    2 Yes 1 No

write a program in c++ to generate imp z y x w v w x y z ..

Answer / gayatri chhotray

#include<iostream>
using namespace std;
int main()
{
int i;
int j;
int n = 118;
char c;
for(i = 1; i <= 5; i++)
{
for(j = 122; j >= n +(i-1); j--)
{
c = j;
cout<<c<<" ";
}
for(j=j+2; j<=122; j++)
{
c = j;
cout<<c<<" ";
}
}
return 0;
}

Is This Answer Correct ?    2 Yes 2 No

Post New Answer

More C++ General Interview Questions

Define private, protected and public access control.

0 Answers  


what do you mean by memory management operators

4 Answers   HCL,


What are Binay tress and B trees? Diff between them?

8 Answers   CTS, GATE, Wipro,


Write a corrected statement in c++ so that the statement will work properly. if (x = y) x = 2*z;

2 Answers  


What is a container class? What are the types of container classes in c++?

0 Answers  






Which coding certification is best?

0 Answers  


What size is allocated to the union variable?

0 Answers  


If a base class declares a function to be virtual, and a derived class does not use the term virtual when overriding that class, is it still virtual when inherited by a third-generation class?

0 Answers  


How do you allocate and deallocate memory in C++?

1 Answers  


can anybody please tell me how to write a program in c++,without using semicolon(;)

6 Answers   NIIT,


What is the c++ programming language used for?

0 Answers  


What is private, public and protected inheritance?

0 Answers  


Categories