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

Answers were Sorted based on User's Feedback



Write a program in c to print 1 121 12321 1234321 1234..

Answer / vivek raghuwanshi

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

Is This Answer Correct ?    13 Yes 31 No

Post New Answer

More C Interview Questions

program that accepts amount in figures and print that in words

2 Answers   Infosys, Lovely Professional University, Wipro,


what is the flow of execution in cprogram? ex:printf();,scanf();

2 Answers  


c program to add and delete an element from circular queue using array

3 Answers  


Tell me when would you use a pointer to a function?

0 Answers  


#define f(x) main() { printf("\n%d",f(2+2)); }

5 Answers  






Difference between pass by reference and pass by value?

0 Answers   TCS, TISL,


why we use pointer in c

7 Answers   HCL, TCS,


main() { int arr[5]={23,67}; printf("%d%d%d",arr[2],arr[3],arr[4]); }

9 Answers   TCS,


Lists the benefits of c programming language?

0 Answers  


What are near, far and huge pointers?

0 Answers   Hexaware, Thomson Reuters, Virtusa,


Is it valid to address one element beyond the end of an array?

0 Answers  


how can i print "hello"

3 Answers  


Categories