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
Why enum is used in c?
Can you think of a logic behind the game minesweeper.
What is the use of putchar function?
Explain the difference between getch() and getche() in c?
What language is windows 1.0 written?
What is data type long in c?
Explain what is #line used for?
Explain 'bus error'?
What is the difference between NULL and NUL?
What is difference between && and & in c?
Which is not valid in C a) class aClass{public:int x;}; b) /* A comment */ c) char x=12;
What is getche() function?
Do pointers need to be initialized?
Describe the modifier in c?
in multiple branching construct "default" case is a) optional b) compulsarily c) it is not include in this construct d) none of the above