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 does 4d mean in c?
Tell me with an example the self-referential structure?
int main() { Int n=20,i; For(i=0;i<=n;i--) { Printf(“-“); Return 0;
What are the salient features of c languages?
What are local variables c?
how do you write a function that takes a variable number of arguments? What is the prototype of printf () function?
What is mean by Data Driven framework in QTP? Can any one answer me in details on this regard.
When should you not use a type cast?
Which of these functions is safer to use : fgets(), gets()? Why?
Explain what is the difference between a string and an array?
Which is best linux os?
which type of aspect you want from the student.
What is context in c?
write an algorithm to display a square matrix.
Why we write conio h in c?