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

How can you pass an array to a function by value?

702


What does s c mean in text?

712


What is derived datatype in c?

731


Explain what is dynamic data structure?

759


In c programming write a program that will print 10 multiples of 3 except 15,18,21 using looping

1083






What is the difference between constant pointer and constant variable?

842


Why is c faster?

681


How can I do graphics in c?

678


Write a program to print factorial of given number using recursion?

706


Once I have used freopen, how can I get the original stdout (or stdin) back?

723


What does c mean before a date?

715


Are local variables initialized to zero by default in c?

645


What is a node in c?

650


What is linear search?

786


What does malloc () calloc () realloc () free () do?

674