Write a program in c to print
1
121
12321
1234321
123454321
Answer Posted / arun c s
#include <stdio.h>
main()
{
int i, j, k, space, n=9;
for (i=1; i<=n; i++)
{
for (j=1; j<=n-i; j++)
putchar(' ');
for (j=1,k=2*i-1; j<=2*i-1; j++,k--)
{
if (j <= k)
printf("%d", j);
else
printf("%d", k);
}
putchar('
');
}
getch();
}
| Is This Answer Correct ? | 4 Yes | 3 No |
Post New Answer View All Answers
Why can’t constant values be used to define an array’s initial size?
write a program to print largest number of each row of a 2D array
What are register variables? What are the advantage of using register variables?
what is use of malloc and calloc?
Why do we use pointer to pointer in c?
Where does the name "C" come from, anyway?
Using functions, write a program that multiplies two arrays. Use the following functions: - Function ReadArray - Function MultiplyArrays - Function DisplayArrays
What are header files and explain what are its uses in c programming?
Write a program to use switch statement.
hw can we delete an internal node of binary search tree the internal node has child node..plz write progarm
What are structural members?
Can we change the value of #define in c?
how much salary u want ? why u join in our company? your domain is core sector why u prefer software ?
What is 1f in c?
What is volatile variable how do you declare it?