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 / eranna

#include<stdio.h>
void main()
{
int i,j,n,k;

printf("Enter no.of lines :");
scanf("%d",&n);

for(i=1;i<=n;i++)
{
printf("\t");
for(j=1;j<=n-i;j++)
printf(" ");
for(j=1;j<=i;j++)
printf("%d",j);

for(k=j-2;k>0;k--)
printf("%d",k);

printf("\n");
}


}

Is This Answer Correct ?    13 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Create a structure to specify data on students as given below: Roll number, Name, Department, Course, and Year of joining. Assume that there are not more than 450 students in the collage. (a) Write a function to print the names of all students who joined in the last 3 years. (b) Write a function to print the data of a student whose roll numbers are divisible by 4.

594


What is the difference between ++a and a++?

686


Explain what is a pragma?

587


What are linker error?

612


If errno contains a nonzero number, is there an error?

798






Explain how do you use a pointer to a function?

636


what is the syallabus of computer science students in group- 1?

1836


Want to know how to write a C program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.

1515


what are bit fields? What is the use of bit fields in a structure declaration?

1497


Explain enumerated types.

595


What is a file descriptor in c?

557


What is the best way to comment out a section of code that contains comments?

776


What is the meaning of 2d in c?

607


What is typedef struct in c?

579


1.int a=10; 2.int b=20; 3. //write here 4.b=30; Write code at line 3 so that when the value of b is changed variable a should automatically change with same value as b. 5.

1657