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

Answer Posted / sahil and dipanshu

#include<stdio.h>
#include<iostream.h>

int main()
{
int i,j,k,num;
num=5;
for(i=1;i<=num;i++)
{
for(j=1;j<num-i;j++)
{
cout<<" ";
}
for(k=1;k<=i;k++)
{
cout<<k;
}
for(k=i;k>1;k--)
{
cout<<k-1;
}
cout<<endl;
}
return 0;
}

Is This Answer Correct ?    21 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is pivot in c?

564


What is break in c?

585


in ‘C’ language for Matrix Multiplication fails” Introspect the causes for its failure and write down the possible reasons for its failure.

7387


What are lookup tables in c?

548


Explain the process of converting a Tree into a Binary Tree.

2098






The number of measuring units from an arbitarary starting point in a record,area,or control block to some other point a) recording pointer b) offset c) branching d) none

704


What is "Hungarian Notation"?

633


HOW TO SOLVE A NUMERICAL OF LRU IN OS ??????

2263


What is property type c?

599


What is pointers in c?

646


What is the size of enum in bytes?

581


Can you please explain the difference between exit() and _exit() function?

585


What is the use of sizeof?

553


Is null always defined as 0(zero)?

612


Describe static function with its usage?

606