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
What are nested functions in c?
Why is c called a structured programming language?
What does static variable mean in c?
What are keywords c?
Explain how are 16- and 32-bit numbers stored?
The difference between printf and fprintf is ?
How pointer is different from array?
pgm to find number of words starting with capital letters in a file(additional memory usage not allowed)(if a word starting with capital also next letter in word is capital cann't be counted twice)
What are two dimensional arrays alternatively called as?
What are the header files used in c language?
Explain why can’t constant values be used to define an array’s initial size?
Write a program to generate random numbers in c?
What is the use of ?
pierrot's divisor program using c or c++ code
Write a programme using structure that create a record of students. The user allow to add a record and delete a record and also show the records in ascending order.