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 are the advantages of external class?
Are pointers really faster than arrays?
Why do we need functions in c?
what is uses of .net
What is ponter?
What is a newline escape sequence?
What is structure and union in c?
What is difference between structure and union with example?
How can I pad a string to a known length?
how should functions be apportioned among source files?
Explain argument and its types.
How to set file pointer to beginning c?
Why string is used in c?
What is the right type to use for boolean values in c? Is there a standard type?
What is int main () in c?