Write a program in c to print
1
121
12321
1234321
123454321
Answer Posted / mohammedayub.y(c.i.e.t)
#include<stdio.h>
#include<conio.h>
int main()
{
int i,j,n,k;
printf("enter the number :");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(k=n;k>i;k--)printf(" ");
for(j=1;j<=i;j++)
{
printf("%d",j);
}
if(i>1)
{
for(j=i;j>1;j--)
{
printf("%d",j-1);
}
}
printf("\n");
}
getch();
return 0;
}
Is This Answer Correct ? | 72 Yes | 28 No |
Post New Answer View All Answers
What is printf () in c?
Explain the difference between #include "..." And #include <...> In c?
Do you know the use of fflush() function?
What is a function in c?
Is fortran still used today?
Differentiate between a structure and a union.
write an algorithm to display a square matrix.
What math functions are available for integers? For floating point?
How many types of errors are there in c language? Explain
What are data structures in c and how to use them?
Which one to choose from 'initialization lists' or 'assignment', for the use in the constructor?
What does p mean in physics?
When should I declare a function?
what does static variable mean?
You are to write your own versions of strcpy() and strlen (). Call them mystrcpy() and mystrlen(). Write them first as code within main(), not as functions, then, convert them to functions. You will pass two arrays to the function in the case of mystrcpy(), the source and target array.