Write a program in c to print
1
121
12321
1234321
123454321
Answer Posted / arun c s
#include <stdio.h>
main()
{
int i, j, k, space, n=9;
for (i=1; i<=n; i++)
{
for (j=1; j<=n-i; j++)
putchar(' ');
for (j=1,k=2*i-1; j<=2*i-1; j++,k--)
{
if (j <= k)
printf("%d", j);
else
printf("%d", k);
}
putchar('
');
}
getch();
}
Is This Answer Correct ? | 4 Yes | 3 No |
Post New Answer View All Answers
What is an identifier?
Give a one-line C expression to test whether a number is a power of 2. [No loops allowed - it's a simple test.]
How is a macro different from a function?
how much salary u want ? why u join in our company? your domain is core sector why u prefer software ?
What is the difference between fread buffer() and fwrite buffer()?
Create a structure to specify data on students given below: Roll number, Name, Department, Course, Year of joining Assume that there are not more than 450 students in the college. 1.write a function to print names of all students who joined in a particular year 2.write a function to print the data of a student whose roll number is given
How we can insert comments in a c program?
What does sizeof int return?
Where are c variables stored in memory?
how to build a exercise findig min number of e heap with list imlemented?
what is the structure pointer?
C program to find all possible outcomes of a dice?
Why do we use & in c?
What are the 5 elements of structure?
Describe dynamic data structure in c programming language?