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


Please Help Members By Posting Answers For Below Questions

Is c procedural or functional?

582


What is the use of ?: Operator?

660


how to print the character with maximum occurence and print that number of occurence too in a string given ?

2029


Why we use stdio h in c?

575


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.

2653






Is c call by value?

599


What is meant by 'bit masking'?

880


What is assert and when would I use it?

573


Which is the best website to learn c programming?

576


what is event driven software and what is procedural driven software?

2005


How would you rename a function in C?

612


How can I do serial ("comm") port I/O?

681


How do I read the arrow keys? What about function keys?

610


Can I initialize unions?

585


largest Of three Number using without if condition?

995