Write a program in c to print
1
121
12321
1234321
123454321

Answer Posted / sabby

#include<stdio.h>
main()
{
int i,j,s,n;
printf("Enter the number of rows:");
scanf("%d\n",&n);
for(i=1;i<=n;i++)
{
for(s=1;s<=n-i;s++)
printf(" ");
for(j=1;j<=i;j++)
printf("%d",j);
j=j-2;
for(;j>=1;j--)
{
printf("%d",j);
}
printf("\n");
}
}

Is This Answer Correct ?    16 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

a formula,a series of steps,or well defined set of rules for solving a problem a) algorithem b) program c) erdiagram d) compiler

714


What is the importance of c in your views?

681


What is masking?

748


Hi can anyone tell what is a start up code?

1725


will u please send me the placement papers to my mail???????????????????

1456






What is the use of a conditional inclusion statement in C?

709


How to get string length of given string in c?

698


Explain the bubble sort algorithm.

759


What are pointers?

722


What is hashing in c language?

727


Define Spanning-Tree Protocol (STP)

752


Tell us two differences between new () and malloc ()?

711


What are the __date__ and __time__ preprocessor commands?

674


write a program to convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix.

3595


Why c language is called c?

658