64 573
Assignments Done
99,2%
Successfully Done
In September 2018

Answer to Question #13315 in C++ for swapnil sahu

Question #13315
display the following
1
121
12321
1234321
12321
121
1
Expert's answer
#include<stdio.h>
#include<conio.h>
int main()
{
int num,r,c,sp;
printf("Enter number of rows : ");
scanf("%d",&num);
for(r=1; r<=num; r++)
{
for(sp=num-r; sp>=1; sp--)
printf(" ");
for(c=1; c<=r; c++)
printf("%d",c);
for(c=r-1; c>=1; c--)
printf("%d",c);
printf("
");
}
for(r=1; r<=num; r++)
{
for(sp=r; sp>=1; sp--)
printf(" ");
for(c=1; c<=(num-r); c++)
printf("%d",c);
for(c=num-r-1; c>=1; c--)
printf("%d",c);
printf("
");
}
getch();
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions