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

Answer Posted / roshan patil

#include<iostream.h>
#include<conio.h>
void main()
{
int i,j,k,num;
cout<<num;
for(i=1;i<=num;i++)
{
for(j=1;j<num-1;j++)
{
cout<<" ";
}
for(k=1;k<i;k++)
{
cout<<k;
}
for(k=i;k>=1;k--)
{
cout<<k;
}
}
}

Is This Answer Correct ?    12 Yes 14 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Find the second largest element in an array with minimum no of comparisons and give the minimum no of comparisons needed on an array of size N to do the same.

829


Write a program to swap two numbers without using the third variable?

694


Compare interpreters and compilers.

727


Why is C language being considered a middle level language?

742


What is the general form of function in c?

700






Is file a keyword in c?

598


how is the examination pattern?

1693


Is struct oop?

665


What is sizeof array?

697


What is the use of parallelize in spark?

650


Explain what is page thrashing?

727


What is a good way to implement complex numbers in c?

693


Explain the difference between exit() and _exit() function?

753


Do you have any idea about the use of "auto" keyword?

747


Why is c called a structured programming language?

827