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 / sakthivel

/*
Written By : Sakthivel
Tested By : Rajavelraj
*/




#include<stdio.h>
#include<conio.h>

public void main()
{

int i,j,k,l,a=1;

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

for(k=1;k<=i;k++)
{
printf("%d",k);
}

for(l=i;l>1;l--)
{
printf("%d",l-1);
}

printf("\n");
}

for(i=4;i>1;i--)
{
for(j=1;j<=a;j++)
{
printf(" ");
}

for(k=1;k<i;k++)
{
printf("%d",k);
}

for(l=k-1;i>1;l--)
{
printf("%d",l-1);
}
a=a+1;
printf("\n");
}
getch();
}

Is This Answer Correct ?    2 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can 'this' pointer by used in the constructor?

1094


Where is c used?

1093


Why & is used in scanf in c?

1102


Design a program which assigns values to the array temperature. The program should then display the array with appropriate column and row headings.

2325


Can we declare variable anywhere in c?

972


What is the difference between #include

and #include “header file”?

1033


What is the use of ?: Operator?

1137


What is the difference between procedural and declarative language?

1143


which of the following is allowed in a "C" arithematic instruction a) [] b) {} c) () d) none of the above

1723


In c programming typeing to occupy the variables in memory space. if not useing the variable the memory space is wasted.ok, how to avoid the situation..? (the variable is used & notused)

2127


What is the difference between malloc calloc and realloc in c?

1147


List the difference between a While & Do While loops?

1102


What is the equivalent code of the following statement in WHILE LOOP format?

1306


Write a program to check armstrong number in c?

1132


if the area was hit by a virus and so the decrease in the population because of death was x/3 and the migration from other places increased a population by 2x then annually it had so many ppl. find our the population in the starting.

5236