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
Explain how do I determine whether a character is numeric, alphabetic, and so on?
Are pointers really faster than arrays?
Explain how can I make sure that my program is the only one accessing a file?
If one class contains another class as a member, in what order are the two class constructors called a) Constructor for the member class is called first b) Constructor for the member class is called second c) Only one of the constructors is called d) all of the above
Write a code to generate a series where the next element is the sum of last k terms.
Explain with the aid of an example why arrays of structures don’t provide an efficient representation when it comes to adding and deleting records internal to the array.
What does malloc () calloc () realloc () free () do?
What is the difference between null pointer and wild pointer?
What are the different file extensions involved when programming in C?
What is array in c with example?
What is const keyword in c?
What is void c?
What are the types of i/o functions?
Why doesnt the call scanf work?
Which built-in library function can be used to match a patter from the string?