Write a program in c to print
1
121
12321
1234321
123454321
Answer Posted / mohammedayub.y(c.i.e.t)
#include<stdio.h>
#include<conio.h>
int main()
{
int i,j,n,k;
printf("enter the number :");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(k=n;k>i;k--)printf(" ");
for(j=1;j<=i;j++)
{
printf("%d",j);
}
if(i>1)
{
for(j=i;j>1;j--)
{
printf("%d",j-1);
}
}
printf("\n");
}
getch();
return 0;
}
| Is This Answer Correct ? | 72 Yes | 28 No |
Post New Answer View All Answers
What is boolean in c?
Explain how do you use a pointer to a function?
what do the 'c' and 'v' in argc and argv stand for?
Explain what are the standard predefined macros?
What is the equivalent code of the following statement in WHILE LOOP format?
Is main is a keyword in c?
What is the difference between new and malloc functions?
How many types of operator or there in c?
in any language the sound structure of that language depends on its a) character set, input/output function, its control structures b) character set, library functions, input/output functions its control structures c) character set, library functions, control sturctures d) character set, operators, its control structures
What is else if ladder?
what is the c source code for the below output? 10 10 10 10 10 10 10 10 10 10 9 9 7 6 6 6 6 6 6 9 7 5 9 7 3 2 2 5 9 7 3 1 5 9 7 3 5 9 7 4 4 4 4 5 9 7 8 8 8 8 8 8 8 8 9
The statement, int(*x[]) () what does in indicate?
Between macros and functions,which is better to use and why?
What are different types of operators?
a single linked list consists of nodes a to z .print the nodes in reverse order from z to a using recursion