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


Please Help Members By Posting Answers For Below Questions

What is a struct c#?

596


Explain the binary height balanced tree?

714


Why c is called a mid level programming language?

599


Write a program to find the biggest number of three numbers in c?

584


Can you please explain the difference between exit() and _exit() function?

582






Why is c known as a mother language?

738


Explain void pointer?

583


What is sorting in c plus plus?

561


What is a volatile keyword in c?

632


What could possibly be the problem if a valid function name such as tolower() is being reported by the C compiler as undefined?

736


Can main () be called recursively?

620


#define f(g,h) g##h main O int i=0 int var=100 ; print f ("%d"f(var,10));} wat would be the output??

1535


When should the volatile modifier be used?

675


what will be the output for the following main() { printf("hi" "hello"); }

9297


What functions are used for dynamic memory allocation in c language?

592