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............?

Answers were Sorted based on User's Feedback



Write a program for the following series? 1 ..

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

Write a program for the following series? 1 ..

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

Write a program for the following series? 1 ..

Answer / kkx

hi this is no the pgrm
let u want to find nth number


value = "n";
while(n-1)
{
value = value+ "n-1";
value= "n-1" + value;
n= n-1;
}

Is This Answer Correct ?    7 Yes 2 No

Write a program for the following series? 1 ..

Answer / ubaid

Try this program it will show ascending and descending both order. i hope it work correct .. .please try
#include<conio.h>
#include<stdio.h>
void Ubaid(int x)
{
for(int i=x;i>0;i--)
{
printf("\n");
for(int j=1; j<=i; j++)
{
printf("%d",j);
}
for(int u=i-1;u>0;u--)
{
printf("%d",u);
}
}
//start another from here
for(int p=1;p<=x;p++)
{
printf("\n");
for(int e=1;e<p;e++)
{
printf("%d",e);
}
for(int o=e;o>0;o--)
{
printf("%d",o);
}
}

}
void main()
{
clrscr();
printf("the output of function is..");
printf("\n");
printf("\n");
Ubaid(6);
getch();
}

Is This Answer Correct ?    3 Yes 0 No

Write a program for the following series? 1 ..

Answer / ubaid

Copy and paste it will run successfully..
#include<conio.h>
#include<stdio.h>
void Ubaid(int x)
{
for(int i=x;i>0;i--)
{
printf("\n");
for(int j=1; j<=i; j++)
{
printf("%d",j);
}
for(int u=i-1;u>0;u--)
{
printf("%d",u);
}
}
//start another from here
for(int p=1;p<=x;p++)
{
printf("\n");
for(int e=1;e<p;e++)
{
printf("%d",e);
}
for(int o=e;o>0;o--)
{
printf("%d",o);
}
}

}
void main()
{
clrscr();
printf("the output of function is..");
printf("\n");
printf("\n");
Ubaid(6);
getch();
}

Is This Answer Correct ?    2 Yes 1 No

Post New Answer

More C Interview Questions

2. What is the function of ceil(X) defined in math.h do? A)It returns the value rounded down to the next lower integer B)it returns the value rounded up to the next higher integer C)the Next Higher Value D)the next lower value

3 Answers   Accenture,


player is good if the following conditions are satisfied: He is either from “India”, “Japan” or “Korea” He has a minimum of 3 years of experience He has won at least 3 major tournaments, and one of them must be "World Championship Tournament". He must know more than 10 techniques. (but see next question) If he knows less than 10 techniques, then he must be a world champion. His name contains at least 3 words. For example "Sachin Tendulkar" will not meet this condition. Write a method: boolean isGoodPlayer(String name, String country, int yearsExperience, String[] majorTournamentsWon, String[] techniques, boolean isWorldChampion) name country yearsExperience majorTournamentsWon techniques isWorldChampion

1 Answers  


What is character constants?

0 Answers  


What do you mean by invalid pointer arithmetic?

0 Answers  


what is the output of the following program? main() { int i=-1,j=-1,k=0,l=2,m; m=i++&&j++&&k++||l++; printf("%d %d %d %d %d",i,j,k,l,m); }

7 Answers  






What does a function declared as pascal do differently?

0 Answers  


Given an array of 1s and 0s arrange the 1s together and 0s together in a single scan of the array. Optimize the boundary conditions?

0 Answers   Infosys,


What is the sizeof () a pointer?

0 Answers  


Write a program for finding factorial of a number.

0 Answers   Tech Mahindra,


how to find the kth smallest element in the given list of array elemnts.

8 Answers   Silicon,


What are the usage of pointer in c?

0 Answers  


What is the difference between functions getch() and getche()?

0 Answers  


Categories