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
What is openmp in c?
What is an arrays?
What are the preprocessor categories?
Which header file should you include if you are to develop a function which can accept variable number of arguments?
What is multidimensional arrays
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)
Explain how can I right-justify a string?
Can you write the algorithm for Queue?
what is the difference between class and unio?
how to solve "unable to open stdio.h and conio.h header files in windows 7 by using Dos-box software
When is a null pointer used?
Explain the difference between ++u and u++?
What is the use of a conditional inclusion statement in C?
What is hungarian notation? Is it worthwhile?
In c programming, explain how do you insert quote characters (? And ?) Into the output screen?