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
Device an algorithm for weiler-atherton polygon clipping, where the clipping window can be any specified polygon
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
why wipro wase
How do you initialize pointer variables?
What is sizeof array?
How can I write functions that take a variable number of arguments?
c program for searching a student details among 10 student details
Explain union. What are its advantages?
Explain about block scope in c?
State the difference between realloc and free.
Explain what is the most efficient way to store flag values?
What should malloc(0) do?
When a c file is executed there are many files that are automatically opened what are they files?
What is the purpose of realloc()?
What is meant by gets in c?