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

Device an algorithm for weiler-atherton polygon clipping, where the clipping window can be any specified polygon

5464


write a programe to accept any two number and check the following condition using goto state ment.if a>b,print a & find whether it is even or odd and then print.and a

1455


why wipro wase

1834


How do you initialize pointer variables?

616


What is sizeof array?

616






How can I write functions that take a variable number of arguments?

631


c program for searching a student details among 10 student details

1659


Explain union. What are its advantages?

621


Explain about block scope in c?

663


State the difference between realloc and free.

641


Explain what is the most efficient way to store flag values?

702


What should malloc(0) do?

619


When a c file is executed there are many files that are automatically opened what are they files?

598


What is the purpose of realloc()?

676


What is meant by gets in c?

611