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

can we print any string in c language without using semicolon(;)(terminator) in whole program.

11 Answers  


Why do we use stdio h and conio h?

0 Answers  


Write a c program using for loop to print typical pattern if number of rows is entered by keyboard. ABCBA AB BA A A

1 Answers  


Write a program that accept anumber in words

0 Answers  


Why is sizeof () an operator and not a function?

0 Answers  






write a programe to accept any two number and check the following condition using goto state ment.if a>b,print a & find whether it is even or odd and then print.and a<b,printb.find the sum digits of that number & then print.if a==b multiply 10 with a & add 20 with b store in c and then print

0 Answers  


Write a program to display all the prime nos from 1 to 1000000, your code should not take time more than a minute to display all the nos.

0 Answers  


What are the two forms of #include directive?

0 Answers   Aspire, Infogain,


what is the other ways to find a logic to print whether a number is an even or odd wit out using % symbol??????? i know three different ways to print it. so i need any other different logic>>>>>

5 Answers   TCS,


How can type-insensitive macros be created?

0 Answers  


What is null pointer constant?

0 Answers  


Find Error if any in below code, Justify ur answer: struct xx { int a; struct yy { char c; struct xx* p; } struct yy* q; }

3 Answers   NDS,


Categories