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

Is it better to use malloc() or calloc()?

639


Differentiate between null and void pointers.

620


Why is structure important for a child?

595


Can we change the value of static variable in c?

550


I need a help with a program: Write a C program that uses data input in determining the whole of points A and a whole of circles B. Find two points in A so that the line which passes through them, cut through the maximum number of circles.

1485






how to write optimum code to divide a 50 digit number with a 25 digit number??

2739


How can you tell whether a program was compiled using c versus c++?

613


What is volatile, register definition in C

678


how to make a scientific calculater ?

1552


Differentiate between full, complete & perfect binary trees.

660


Write a code to remove duplicates in a string.

619


Describe the steps to insert data into a singly linked list.

612


What is the difference between class and object in c?

571


What does c value mean?

613


How can you allocate arrays or structures bigger than 64K?

674