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

Answer Posted / vivek raghuwanshi

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k,num;
cout<<num;
for(i=1;i<=num;i++)
{
for(j=1;j<i-1;j++)
{
cout<<" ";
}
for(k=1;k<i;k++)
{
cout<<k;
}
for(k=i;k>=1;k--)
{
cout<<k;
}
}
}

Is This Answer Correct ?    13 Yes 31 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is c language in simple words?

584


What is exit() function?

556


If one class contains another class as a member, in what order are the two class constructors called a) Constructor for the member class is called first b) Constructor for the member class is called second c) Only one of the constructors is called d) all of the above

615


Hello. How to write a C program to check and display president party like if i type in the console "biden" and hit enter the output shoud be : "biden is democrat" and if i type "trump" and hit enter the output shoud be: "trump is republican"

1576


Explain what does it mean when a pointer is used in an if statement?

611






What is bss in c?

594


What is the Purpose of 'extern' keyword in a function declaration?

643


what is the c source code for the below output? 5555555555 4444 4444 333 333 22 22 1 1 22 22 333 333 4444 4444 5555555555

2526


What is the basic structure of c?

549


int i=3; this declaration tells the C compiler to a) reserve space in memory to hold the integer value b) associate the name i with this memory location c) store the value 3 at this location d) all the above

734


Why c is called a mid level programming language?

599


write a program to display all prime numbers

1448


explain what are actual arguments?

626


Is c still used?

591


What does void main () mean?

719