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 to compare array with pointer in c?
printf(), scanf() these are a) library functions b) userdefined functions c) system functions d) they are not functions
What are the restrictions of a modulus operator?
How does placing some code lines between the comment symbol help in debugging the code?
What is enumerated data type in c?
Describe the order of precedence with regards to operators in C.
What is void pointers in c?
What are variables c?
What is structure padding in c?
Explain what math functions are available for integers? For floating point?
What is return in c programming?
Which is not valid in C a) class aClass{public:int x;}; b) /* A comment */ c) char x=12;
What is a c token and types of c tokens?
FORMATTED INPUT/OUTPUT functions are a) scanf() and printf() b) gets() and puts() c) getchar() and putchar() d) all the above
What is a program flowchart?