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 do you search data in a data file using random access method?
What is difference between structure and union in c?
Difference between exit() and _exit() function?
What is a pointer on a pointer in c programming language?
What is uint8 in c?
List the difference between a While & Do While loops?
Explain how to reverse singly link list.
Write a programme using structure that create a record of students. The user allow to add a record and delete a record and also show the records in ascending order.
What is a c token and types of c tokens?
What are formal parameters?
What is static identifier?
Where is c used?
What is c method?
void main(){ int a; a=1; while(a-->=1) while(a-->=0); printf("%d",a); }
Here is a good puzzle: how do you write a program which produces its own source code as output?