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 extern variable in c with example?
If one class contains another class as a member, in what order are the two class constructors called a) Constructor for the member class is called first b) Constructor for the member class is called second c) Only one of the constructors is called d) all of the above
What are the main characteristics of c language describe the structure of ac program?
What is the difference between call by value and call by reference in c?
What is the use of f in c?
What are the usage of pointer in c?
What is the meaning of typedef struct in c?
What is the difference between fread and fwrite function?
Explain that why C is procedural?
What is string in c language?
Explain 'bit masking'?
How is a structure member accessed?
What is the difference between if else and switchstatement
What is typedf?
Tell me with an example the self-referential structure?