ALLInterview.com :: Home Page            
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Google
   
 
Categories >> Software >> Programming Languages >> C++ >> OOPS
 
 


 

 
 STL interview questions  STL Interview Questions (93)
 OOPS interview questions  OOPS Interview Questions (563)
 C++ General interview questions  C++ General Interview Questions (459)
Question
1234554321
1234  4321
123    321
12      21
1        1
12      21
123    321
1234  4321
1234554321
 Question Submitted By :: OOPS
I also faced this Question!!     Answer Posted By  
 
Answer
# 1
#include <iostream>
using namespace std;

int main()
{

int MAX =5; /*the number to which series needs to
be created*/
int i,j,k;

/* this loop will print first half of the series*/
for (int m = MAX; m >0 ; m-- )
{
cout<<endl;

for( i =0; i<m; i++) /*loop to print start
numbers from 1 to MAX in each line*/
cout<<(i+1);

for( k = 0; k< 2*(MAX-i);k++) /*space which
needs to be printed after the incremented num*/
cout<<" ";

for( j = i ; j>0 ; j--)/* loop to print
decremented num*/
cout<<j;

}

/* this loop will print next half of the series -
duplicate line skipped*/
for ( int n = 2; n <= MAX ; n++ )
{
cout<<endl;
for ( i = 0; i<n ; i++)
cout<<(i+1);

for( k = 0; k< 2*(MAX-i);k++)
cout<<" ";

for( j = i ; j>0 ; j--)
cout<<j;

}

cout<<endl;
}
 
Is This Answer Correct ?    3 Yes 0 No
C++ Coder
 

 
 
 
Other OOPS Interview Questions
 
  Question Asked @ Answers
 
Why many objects can working together? How objects working togetherM I want to see example code.   2
what is single inheritance? IBM 18
i ahve v low % in 12th n BSC which is aroun 50 coz science was imposed on me......nw m doin MCA n my aggregate in above 74%,what shud i say if asked about low previous percentage??????   4
sir i want to know which posting to apply since i am BE CSE.. also want to know what are the rounds there for my interview...Expecting for ur valuable answer....   2
Difference between new operator and operator new   2
Which keyword is written to use a variable declared in one class in the other class? TCS 5
what is the size of an empty class Wipro 12
what is virtual function in c++   6
What is the output of the following code: int v() { int m=0; return m++; } int main() { cout<<v(); } 1) 1 2) 0 3) Code cannot compile   4
1234554321 1234 4321 123 321 12 21 1 1 12 21 123 321 1234 4321 1234554321   1
what is a binary overloading   2
What is sub classing in c++?   1
 
For more OOPS Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
   
Copyright 2013  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  KalAajKal.com