Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


1234554321
1234 4321
123 321
12 21
1 1
12 21
123 321
1234 4321
1234554321

Answers were Sorted based on User's Feedback



1234554321 1234 4321 123 321 12 21 1 1 12 21 123 321 1234 4321 1234..

Answer / c++ coder

#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 ?    4 Yes 0 No

1234554321 1234 4321 123 321 12 21 1 1 12 21 123 321 1234 4321 1234..

Answer / mahesh m

#include<stdio.h>
int main()
{
int i,j,n=5,a;
for (i=1;i<5;i++)
{
for(j=1;j<=n;j++)
{
printf("%d",j);
a=j;
}
for(int k=1;k<=n;k++)
{
printf("%d",a);
a--;
}
n=n-1;
}
}

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More OOPS Interview Questions

Why do we use polymorphism?

0 Answers  


What is Virtual Keyword?

9 Answers   IBM, NA,


What is difference between oop and pop?

0 Answers  


Is enum a class?

0 Answers  


How do you make derived class as an abstract class?

1 Answers   Convergys, TCS,


Why a "operator=(...)" when there is a copy ctor?

2 Answers  


what is cast operator?

2 Answers   Microsoft,


Which language is pure oop?

0 Answers  


Explain polymorphism? What r the types of polymorphism? pls give examples?

4 Answers   HCL,


Which is not an object oriented programming language?

0 Answers  


what is difference b/w object based and object oriented programming language?

18 Answers   Chaitanya, College School Exams Tests, Educomp, IBM, Infosys, Telko,


oops concept is used for?

3 Answers   Synergy,


Categories