Write a program in c to print
1
121
12321
1234321
123454321
Answer Posted / sabby
#include<stdio.h>
main()
{
int i,j,s,n;
printf("Enter the number of rows:");
scanf("%d\n",&n);
for(i=1;i<=n;i++)
{
for(s=1;s<=n-i;s++)
printf(" ");
for(j=1;j<=i;j++)
printf("%d",j);
j=j-2;
for(;j>=1;j--)
{
printf("%d",j);
}
printf("\n");
}
}
Is This Answer Correct ? | 16 Yes | 7 No |
Post New Answer View All Answers
What is struct node in c?
What is spark map function?
Why clrscr is used after variable declaration?
Can you apply link and association interchangeably?
How do we make a global variable accessible across files? Explain the extern keyword?
What does the c in ctime mean?
What is the difference between text and binary i/o?
List the difference between a While & Do While loops?
What is keyword in c?
What is the use of header files?
if the area was hit by a virus and so the decrease in the population because of death was x/3 and the migration from other places increased a population by 2x then annually it had so many ppl. find our the population in the starting.
Can a pointer point to null?
Write a program to implement a round robin scheduler and calculate the average waiting time.Arrival time, burst time, time quantum, and no. of processes should be the inputs.
What is %s and %d in c?
Is c++ based on c?