Write a program in c to print
1
121
12321
1234321
123454321
Answer Posted / roshan patil
#include<iostream.h>
#include<conio.h>
void main()
{
int i,j,k,num;
cout<<num;
for(i=1;i<=num;i++)
{
for(j=1;j<num-1;j++)
{
cout<<" ";
}
for(k=1;k<i;k++)
{
cout<<k;
}
for(k=i;k>=1;k--)
{
cout<<k;
}
}
}
| Is This Answer Correct ? | 12 Yes | 14 No |
Post New Answer View All Answers
What is a void pointer in c?
Are local variables initialized to zero by default in c?
which type of aspect you want from the student.
The purpose of this exercise is to benchmark file writing and reading speed. This exercise is divided into two parts. a). Write a file character by character such that the total file size becomes approximately >10K. After writing close the file handler, open a new stream and read the file character by character. Record both times. Execute this exercise at least 4 times b). Create a buffer capable of storing 100 characters. Now after generating the characters, first store them in the buffer. Once the buffer is filled up, store all the elements in the file. Repeat the process until the total file size becomes approximately >10K.While reading read a while line, store it in buffer and once buffer gets filled up, display the whole buffer. Repeat the exercise at least 4 times with different size of buffer (50, 100, 150 …). Records the times. c). Do an analysis of the differences in times and submit it in class.
What are the types of pointers?
I have a varargs function which accepts a float parameter?
What is a pointer in c?
What is calloc in c?
In C programming, what command or code can be used to determine if a number of odd or even?
How can I write functions that take a variable number of arguments?
What do you understand by normalization of pointers?
Which are low level languages?
Why main is used in c?
What is c token?
What does double pointer mean in c?