Write a program in c to print
1
121
12321
1234321
123454321
Answer Posted / sahil and dipanshu
#include<stdio.h>
#include<iostream.h>
int main()
{
int i,j,k,num;
num=5;
for(i=1;i<=num;i++)
{
for(j=1;j<num-i;j++)
{
cout<<" ";
}
for(k=1;k<=i;k++)
{
cout<<k;
}
for(k=i;k>1;k--)
{
cout<<k-1;
}
cout<<endl;
}
return 0;
}
Is This Answer Correct ? | 21 Yes | 8 No |
Post New Answer View All Answers
What are the types of functions in c?
Are bit fields portable?
What is scope rule in c?
What is a const pointer in c?
What are the properties of union in c?
What is character set?
How main function is called in c?
What are all different types of pointers in c?
How can I send mail from within a c program?
What does %c mean in c?
How pointers are declared?
What oops means?
What is the scope of static variables in c language?
What does p mean in physics?
What is merge sort in c?