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 (91)
 OOPS interview questions  OOPS Interview Questions (558)
 C++ General interview questions  C++ General Interview Questions (458)
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 we are declare the function in the abstract class even though we are declaring it in Derived class? TCS 1
namespace is working on which compiler?   3
what is the main difference between c and c++? Microsoft 386
When is an object created and what is its lifetime? IBM 4
what is the realstic modeling?   1
4. What do you mean by a prototype? Define analysis prototype   1
What is command routing in MFC GE 1
Out of 4 concepts, which 3 C++ Follow? TCS 1
What are the advantages of inheritance?   25
Program to check whether a word is in all capital letters   1
Precompilation ? emc2 1
How to deploy web appliction in web logic ? Unisys 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