Write a program in c to print
1
121
12321
1234321
123454321
Answer Posted / ayas kumar das
#include"stdio.h"
int main()
{
int i,j,n;
printf("enter the number :");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++)
{
printf("%d",j);
}
if(i>1)
{
for(j=i;j>1;)
{
printf("%d",j-1);
j=j-1;
}
}
printf("\n");
}
return 0;
}
Is This Answer Correct ? | 12 Yes | 20 No |
Post New Answer View All Answers
How is = symbol different from == symbol in c programming?
What is the difference between char array and char pointer?
An integer that indentifies the position of a data item in a sequence of data items a) value b) number c) index d) all of the above
How to explain the final year project as a fresher please answer with sample project
Explain how can I pad a string to a known length?
Write a program, where i have a grid with many cells, how many paths are possible from one point to other desired points.
What is substring in c?
Why is c platform dependent?
Explain how can I read and write comma-delimited text?
7-Given an index k, return the kth row of the Pascal's triangle. For example, when k = 3, the row is [1,3,3,1]. For reference look at the following standard pascal’s triangle.
Do pointers store the address of value or the actual value of a variable?
What kind of structure is a house?
which is conditional construct a) if statement b) switch statement c) while/for d) goto
how to print the character with maximum occurence and print that number of occurence too in a string given ?
When should a type cast be used?