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


Please Help Members By Posting Answers For Below Questions

What is meant by realloc()?

671


What is variable declaration and definition in c?

499


Write a code to achieve inter processor communication (mutual exclusion implementation pseudo code)?

685


On most computers additional memory that is accessed through an adapter of feature card along with a device driver program. a) user memory b) conventional memory c) expandedmemory d) area

660


What does stand for?

590






What is a example of a variable?

551


Write a function stroverlap that takes (at least) two strings, and concatenates them, but does not duplicate any overlap. You only need to worry about overlaps between the end of the first string and the beginning of the second string. Examples: batman, manonthemoon = batmanonthemoon batmmamaman, mamamanonthemoon = batmmamamanonthemoon bat, man = batman batman, batman = batman batman, menonthemoon = batmanmenonthemoon

1732


What does c mean?

586


What is a spanning Tree?

950


What is the mean of function?

644


Is fortran still used in 2018?

590


Explain is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?

669


What is wrong in this statement? scanf(ā€œ%dā€,whatnumber);

722


What is uint8 in c?

638


How to write c functions that modify head pointer of a linked list?

539