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

Explain what is the benefit of using an enum rather than a #define constant?

0 Answers  


Write a program to find the number of times that a given word(i.e. a short string) occurs in a sentence (i.e. a long string!). Read data from standard input. The first line is a single word, which is followed by general text on the second line. Read both up to a newline character, and insert a terminating null before processing. Typical output should be: The word is "the". The sentence is "the cat sat on the mat". The word occurs 2 times.

0 Answers  


write a C program, given number is double without using addt ion and multiplication operator?ex:n=6,ans=12,pls send me ans to goviseenu@gmail.com

6 Answers  


Explain what is the difference between #include and #include 'file' ?

0 Answers  


Explain how do you search data in a data file using random access method?

0 Answers  






Explain what’s a signal? Explain what do I use signals for?

0 Answers  


illustrate the use of address operator and dereferencing operator with the help of a program guys plzzz help for this question

0 Answers  


difference between loading and linking

1 Answers  


What is dynamic variable in c?

0 Answers  


n=7623 { temp=n/10; result=temp*10+ result; n=n/10 }

7 Answers   Wipro,


Write a program to implement a round robin scheduler and calculate the average waiting time.Arrival time, burst time, time quantum, and no. of processes should be the inputs.

0 Answers   Aspiring Minds,


What is advantage of pointer in c?

0 Answers  


Categories