Write a program in c to print
1
121
12321
1234321
123454321

Answer Posted / durai

int a, b;
for( a=1;i<=5;a++)
{
for(b=1;b<=(2*a-1);b++)
{ if(b<=a)
printf b;
else
printf(2*a-b);
}
printf
;
}

Is This Answer Correct ?    0 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between structure and union?

588


The number of bytes of storage occupied by short, int and long are a) 2, 2 and 4 b) 2, 4 and 4 c) 4, 4 and 4 d) none

754


What are logical errors and how does it differ from syntax errors?

643


how to print electricity bill according to following charges first 100 units -1rs per unit for next 200 units-1.50 rs per unit without using conditions

2710


Is sizeof a keyword in c?

570






Why are algorithms important in c program?

610


Explain the meaning of keyword 'extern' in a function declaration.

707


Are the outer parentheses in return statements really optional?

566


What is gets() function?

656


Can you please explain the difference between strcpy() and memcpy() function?

590


What is return type in c?

633


What is a method in c?

612


Hi can anyone tell what is a start up code?

1604


What is stack in c?

599


4. main() { int c=- -2; printf("c=%d",c); }

1360