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 / vidyullatha
#include<stdio.h>
main()
{
int i,j,k,l;
int space=3;
int cnt = 1;
int track=1;
for(i=0;i<4;i++)
{
for(j=1;j<=space;j++)
{
printf(" ");
}
for(k=1;k<=cnt;k++)
{
printf("%d ",k);
}
for(l=k-1;l<track;l++)
{
printf("%d ",track-l);
}
space--;
cnt++;
track=track+2;
printf("\n");
}
space=1;
cnt=3;
track=5;
for(i=0;i<3;i++)
{
for(j=1;j<=space;j++)
{
printf(" ");
}
for(k=1;k<=cnt;k++)
{
printf("%d ",k);
}
for(l=k-1;l<track;l++)
{
printf("%d ",track-l);
}
space++;
cnt--;
track=track-2;
printf("\n");
}
}
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Is c procedural or functional?
What is the use of ?: Operator?
how to print the character with maximum occurence and print that number of occurence too in a string given ?
Why we use stdio h in c?
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.
Is c call by value?
What is meant by 'bit masking'?
What is assert and when would I use it?
Which is the best website to learn c programming?
what is event driven software and what is procedural driven software?
How would you rename a function in C?
How can I do serial ("comm") port I/O?
How do I read the arrow keys? What about function keys?
Can I initialize unions?
largest Of three Number using without if condition?