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
Can we increase size of array in c?
what will be the output for the following main() { printf("hi" "hello"); }
What are the different types of C instructions?
How is pointer initialized in c?
What is return in c programming?
How does normalization of huge pointer works?
What is volatile keyword in c?
What is the use of in c?
difference between native and cross compilers
What is a spanning Tree?
What is meant by inheritance?
Why c is procedure oriented?
What is a class c rental property?
I heard that you have to include stdio.h before calling printf. Why?
int main() { Int n=20,i; For(i=0;i<=n;i--) { Printf(“-“); Return 0;