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 / sakthivel
/*
Written By : Sakthivel
Tested By : Rajavelraj
*/
#include<stdio.h>
#include<conio.h>
public void main()
{
int i,j,k,l,a=1;
for(i=1;i<=4;i++)
{
for(j=4;j>i;j--)
{
printf(" ");
}
for(k=1;k<=i;k++)
{
printf("%d",k);
}
for(l=i;l>1;l--)
{
printf("%d",l-1);
}
printf("\n");
}
for(i=4;i>1;i--)
{
for(j=1;j<=a;j++)
{
printf(" ");
}
for(k=1;k<i;k++)
{
printf("%d",k);
}
for(l=k-1;i>1;l--)
{
printf("%d",l-1);
}
a=a+1;
printf("\n");
}
getch();
}
| Is This Answer Correct ? | 2 Yes | 2 No |
Post New Answer View All Answers
Can 'this' pointer by used in the constructor?
Where is c used?
Why & is used in scanf in c?
Design a program which assigns values to the array temperature. The program should then display the array with appropriate column and row headings.
Can we declare variable anywhere in c?
What is the difference between #include
What is the use of ?: Operator?
What is the difference between procedural and declarative language?
which of the following is allowed in a "C" arithematic instruction a) [] b) {} c) () d) none of the above
In c programming typeing to occupy the variables in memory space. if not useing the variable the memory space is wasted.ok, how to avoid the situation..? (the variable is used & notused)
What is the difference between malloc calloc and realloc in c?
List the difference between a While & Do While loops?
What is the equivalent code of the following statement in WHILE LOOP format?
Write a program to check armstrong number in c?
if the area was hit by a virus and so the decrease in the population because of death was x/3 and the migration from other places increased a population by 2x then annually it had so many ppl. find our the population in the starting.