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
Explain what are run-time errors?
What is masking?
What is multidimensional arrays
Why c language?
What is difference between array and structure in c?
What is echo in c programming?
hi send me sample aptitude papers of cts?
Do string constants represent numerical values?
Can two or more operators such as and be combined in a single line of program code?
When we use void main and int main?
Is that possible to store 32768 in an int data type variable?
Why is c called c not d or e?
How can I direct output to the printer?
What is the purpose of clrscr () printf () and getch ()?
How many types of functions are there in c?