Write a program in c to print
1
121
12321
1234321
123454321
Answer Posted / sabby
#include<stdio.h>
main()
{
int i,j,s,n;
printf("Enter the number of rows:");
scanf("%d\n",&n);
for(i=1;i<=n;i++)
{
for(s=1;s<=n-i;s++)
printf(" ");
for(j=1;j<=i;j++)
printf("%d",j);
j=j-2;
for(;j>=1;j--)
{
printf("%d",j);
}
printf("\n");
}
}
| Is This Answer Correct ? | 16 Yes | 7 No |
Post New Answer View All Answers
What is the use of sizeof?
What does emoji p mean?
Where are local variables stored in c?
Why is c so powerful?
What is default value of global variable in c?
we called a function and passed something do it we have always passed the "values" of variables to the called function. such functions calles are called a) calls by reference b) calls by value c) calls by zero d) none of the above
what is the different bitween abap and abap-hr?
How can I read and write comma-delimited text?
What are integer variable, floating-point variable and character variable?
What is the sizeof () operator?
How do I determine whether a character is numeric, alphabetic, and so on?
List the variables are used for writing doubly linked list program.
What is a structure in c language. how to initialise a structure in c?
What are the types of functions in c?
What is the behavioral difference when include header file in double quotes (“”) and angular braces (<>)?