i want the code for printing the output as follows
4 4
3 3
2 2
1 1
0
1 1
2 2
3 3
4 4
Answer Posted / vignesh1988i
#include<stdio.h>
#include<conio.h>
void main()
{
int m,i,j;
printf("enter the max. number for the series :");
scanf("%d",&m);
for(i=m;i<=0;i--)
{
for(j=0;j<m-i;j++)
printf(" ");
printf("%d",i);
for(j=1;j<=(2*m-(m-i+1+(m-i)));j++)
printf(" ");
printf("%d",i);
printf("\n");
}
i++;
j=m-1;
for(;i<=m;i++)
{
for(;j>(m-i);j--)
printf(" ");
printf("%d",i);
for(j=1;j<(2*i);j++)
printf(" ");
printf("%d",i);
printf("\n");
}
getch();
}
thank u
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
Explain high-order and low-order bytes.
How can I implement a delay, or time a users response, with sub-second resolution?
Implement bit Array in C.
What is difference between array and pointer in c?
List some of the static data structures in C?
Declare the structure which contains the following members and write in C list of all students who score more than 75 marks. Roll No, Name, Father Name, Age, City, Marks.
Add Two Numbers Without Using the Addition Operator
How does free() know explain how much memory to release?
If fflush wont work, what can I use to flush input?
What is the use of putchar function?
What is structure packing in c?
When I set a float variable to, say, 3.1, why is printf printing it as 3.0999999?
What is the difference between text and binary modes?
What is the sizeof () a pointer?
write a program that reads lines(using getline), converts each line to an integer using atoi, and computes the average of all the numbers read. also compute the standard deviation.