Write a program for the following series?

1
121
12321
1234321
123454321
12345654321
1234567654321
123456787654321
12345678987654321
1234567890987654321
123456789010987654321
12345678901210987654321
1234567890123210987654321
.........1234321............
..........123454321............
..........12345654321............
7
8
9
0
1
Pls............?

Answer Posted / vignesh1988i

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k,a,n,s,p;
clrscr();
printf("enter the no. of lines :");
scanf("%d",&n);
a=n;
j=1;
for(i=1;i<=n;i++)
{
for(k=1;k<=(a-1);k++)
printf(" ");
a--;
for(k=1,p=1;k<=(i-1);)
{
if(!((k%10)^0))
p=0;
printf(%d",p);
k++; p++;
}
if(!((i%10)^0)
j=0;
printf("%d",j);
j++;
s=--p;
if(i>10)
{
for(;s>=0;s--)
printf("%d",s);
s=i-(p+1)-1;
}
for(;s>0;s--)
printf("%d",s);
printf("\n");
}
getch();
}


thank u , hope this works

Is This Answer Correct ?    9 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are operators in c?

575


What are the advantages and disadvantages of a heap?

700


Give me the code of in-order recursive and non-recursive.

880


What are the standard predefined macros?

628


How does free() know explain how much memory to release?

616






Write a program to display all the prime nos from 1 to 1000000, your code should not take time more than a minute to display all the nos.

1589


What is NULL pointer?

671


What are the advantages of using macro in c language?

585


What are global variables?

640


What is hashing in c?

638


What functions are used for dynamic memory allocation in c language?

597


In c programming typeing to occupy the variables in memory space. if not useing the variable the memory space is wasted.ok, how to avoid the situation..? (the variable is used & notused)

1631


What is far pointer in c?

805


Explain what are the advantages and disadvantages of a heap?

595


What is new line escape sequence?

805