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...

SIR PLS TELL ME THE CODE IN C LANGUAGE TO PRINT THE
FOLLOWING SERIES
1
1 2 1
1 2 3 2 1
1 2 3 4 3 2 1
1 2 3 2 1
1 2 1
1

Answer Posted / sho

#include <stdio.h>

main()
{
int i =0,j =0,k=0,l=0;

for(i =1; i<=4; i++)
{
l= 4-i;
while(l-- > 0)
{
printf(" ");
}

for (j=1;j<=i;j++ )
printf("%d ",j);

for(j=i-1;j>=1;j--)
printf("%d ",j);

printf("\n");
}
i--;

for(k = i-1;k >= 1;k--)
{
l= 4-k;
while(l-- > 0)
{
printf(" ");
}

for (j=1;j<=k;j++ )
printf("%d ",j);

for(j=k-1;j>=1;j--)
printf("%d ",j);
printf("\n");

}
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why enum is used in c?

951


Can you think of a logic behind the game minesweeper.

2464


What is the use of putchar function?

1057


Explain the difference between getch() and getche() in c?

994


What language is windows 1.0 written?

1059


What is data type long in c?

1076


Explain what is #line used for?

1061


Explain 'bus error'?

1091


What is the difference between NULL and NUL?

1290


What is difference between && and & in c?

1105


Which is not valid in C a) class aClass{public:int x;}; b) /* A comment */ c) char x=12;

1071


What is getche() function?

1039


Do pointers need to be initialized?

1078


Describe the modifier in c?

1102


in multiple branching construct "default" case is a) optional b) compulsarily c) it is not include in this construct d) none of the above

1050