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
 
WHAT IS THE ACTUAL DEFINATION OF OBJECT AND THE CLASS IN ONE SINGLE LINE WHICH THE INTERVIEWER WANT TO LISTEN.   11
what do you mean by static member variable?   2
tel me oops defination in single line   2
Tell me the scenario,Where we can use interfaces or Abstract class.And What is the difference between interfaces and abstract class?   5
what is a virtual class? Cap-Gemini 5
What is the different between Applet and Application?   2
Program to check whether a word is in all capital letters   1
Iam doing my project on instant messaging , if you any new ideas regarding this project ,please suggest it?   2
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
what is SPL in c++.   1
Does c++ support multilevel and multiple inheritance? Wipro 9
Write a C++ program to conduct an election of a mayor.Declare a class ELECTION With the following specification: Data member: Name 25 character Age Integer symbol 1 character Member functions: To accept data for 20 contestant To accept symbol as voting from 100 voters. To declare the winner and the loser. Infotech 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