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
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 |
#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 |
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 |
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 |
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 |
A program to write a number of letters and numbers, such as counting and display
What is the data segment that is followed by c?
. A database table called PERSON contains the fields NAME, BASIC and HRA. Write a computer program to print a report which employee name and total salary for those employees whose total salary is more than 10,000. Total Salary = BASIC + HRA. At the end, the program should also print the total number of employees whose total salary is more than 10,000.
IS STRUCTURES CAN BE USED WITHIN AN ARRAY?
Is sizeof a keyword in c?
how to print "hai" in c?
what is the diffrenet bettwen HTTP and internet protocol
difference between object file and executable file
What are nested functions in c?
What is difference between scanf and gets?
to get a line of text and count the number of vowels in it
How to print all the 26 alphabets in this order in C. AbCdEfGh..... it should print dynamically from a to z and do not print this using pgm like this print("Ab......"); Use loops or anything to print all alphabets