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
How many types of arrays are there in c?
What is a program?
Tell me when would you use a pointer to a function?
List some of the dynamic data structures in C?
Where are the auto variables stored?
What is ctrl c called?
Whats s or c mean?
Why n++ execute faster than n+1 ?
When can a far pointer be used?
What is register variable in c language?
Which function in C can be used to append a string to another string?
Write a program to implement a round robin scheduler and calculate the average waiting time.Arrival time, burst time, time quantum, and no. of processes should be the inputs.
What are data structures in c and how to use them?
What is difference between Structure and Unions?
How can you find the exact size of a data type in c?