Write a program in c to print
1
121
12321
1234321
123454321
Answer Posted / 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 View All Answers
What is a char in c?
What is the use of void pointer and null pointer in c language?
Can we initialize extern variable in c?
Write a program to swap two numbers without using a temporary variable?
Calculate the weighted average of a list of n numbers using the formula xavg = f1x1+f2x2+ ….+ fnxn where the f’s are fractional weighting factors, i.e., 0<=fi<1, and f1+f2+….+fn = 1
Describe newline escape sequence with a sample program?
What is output redirection?
What is n in c?
What does 2n 4c mean?
Explain how can a program be made to print the line number where an error occurs?
Is python a c language?
How do you search data in a data file using random access method?
Explain void pointer?
What does char * * argv mean in c?
What is the basic structure of c?