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
How to write a multi-statement macro?
write a C program: To recognize date of any format even formats like "feb-02-2003","02-february-2003",mm/dd/yy, dd/mm/yy and display it as mm/dd/yy.
What are loops c?
Explain what is a 'locale'?
How can I implement a delay, or time a users response, with sub-second resolution?
Explain the array representation of a binary tree in C.
How many data structures are there in c?
What is void pointers in c?
Is c compiled or interpreted?
Are the outer parentheses in return statements really optional?
How can I implement sets or arrays of bits?
List some of the dynamic data structures in C?
What is the best way of making my program efficient?
What is memory leak in c?
How can you return multiple values from a function?