how can i make a program with this kind of output..
Enter a number: 5
0
01
012
0123
01234
012345
01234
0123
012
01
0
Answer Posted / manoj
#include <stdio.h>
int main ()
{
/*declaration*/
int n = 5 ;
int i, j;
/*clean screen*/
clrscr();
/*actual functionality*/
for( i =0; i<=n; i++)
{
printf("\n");
for(j=0; j<=i; j++)
printf("%d",j);
}
for( i =4; i<n&&i>=0; i--)
{
printf("\n");
for(j=0; j<=i; j++)
printf("%d",j);
}
/*return to TC*/
getch();
return 0;
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
Explain what are multibyte characters?
What is pointer & why it is used?
Why is #define used?
In C language, a variable name cannot contain?
what will be maximum number of comparisons when number of elements are given?
What is the correct declaration of main?
What is the use of the function in c?
Is there a built-in function in C that can be used for sorting data?
the process of defining something in terms of itself is called (or) in C it is possible for the functions to call themselves. A function called a) nested function b) void function c) recursive function d) indifinite function
What is the auto keyword good for?
What does == mean in texting?
Differentiate call by value and call by reference?
What does typedef struct mean?
An expression to whose value an operater is applied a) operand b) variable c) constant d) all of the above
What are the functions to open and close the file in c language?