Write a program in c to print
1
121
12321
1234321
123454321
Answer Posted / ayas kumar das
#include"stdio.h"
int main()
{
int i,j,n;
printf("enter the number :");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++)
{
printf("%d",j);
}
if(i>1)
{
for(j=i;j>1;)
{
printf("%d",j-1);
j=j-1;
}
}
printf("\n");
}
return 0;
}
| Is This Answer Correct ? | 12 Yes | 20 No |
Post New Answer View All Answers
What are pointers? What are different types of pointers?
we need to calculating INCOME TAX for the person. The INCOME TAX is as follows:- First $10000/- of income : 4% tax Next $10000/- of income : 8% tax Next $10000/- of income : 11.5% tax above $10, 00,00/- : 15% tax What is the Solution of this Question ?
Is a house a mass structure?
What do header files do?
Explain what is the heap?
What is the use of typedef in structure in c?
Is fortran still used today?
What does p mean in physics?
In a switch statement, explain what will happen if a break statement is omitted?
Can you subtract pointers from each other? Why would you?
How can I write data files which can be read on other machines with different word size, byte order, or floating point formats?
What is include directive in c?
What are the benefits of c language?
Is c++ based on c?
Write program to remove duplicate in an array?