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

Answer Posted / ayas kumar das

#include"stdio.h"
int main()
{
int i,j,n;
printf("enter the number :");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++)
{
printf("%d",j);
}
if(i>1)
{
for(j=i;j>1;)
{
printf("%d",j-1);
j=j-1;
}
}
printf("\n");
}
return 0;
}

Is This Answer Correct ?    12 Yes 20 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is openmp in c?

602


What is an arrays?

642


What are the preprocessor categories?

626


Which header file should you include if you are to develop a function which can accept variable number of arguments?

795


What is multidimensional arrays

622






Program to find the sum of digits of a given number until the sum becomes a single digit. (e.g. 12345=>1+2+3+4+5=15=>1+5=6)

677


Explain how can I right-justify a string?

612


Can you write the algorithm for Queue?

1538


what is the difference between class and unio?

1850


how to solve "unable to open stdio.h and conio.h header files in windows 7 by using Dos-box software

2781


When is a null pointer used?

626


Explain the difference between ++u and u++?

627


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

590


What is hungarian notation? Is it worthwhile?

683


In c programming, explain how do you insert quote characters (? And ?) Into the output screen?

753