write a program to display the numbers in the following
format
4 4
3 3 3 3
2 2 2 2 2 2
1 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1
2 2 2 2 2
3 3 3
4

Answer Posted / jankipatel

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k,l,p;
clrscr();
// printf("enter the value\n");
// scanf("%d",&l);
for(i=4;i>=0;i--)
{
for(j=4;j>=i;j--)
{
// textcolor(0-i);
printf("%d ",i);
}
for(k=0;k<=i-1;k++)
{
printf(" ");
}
for(k=0;k<=i-1;k++)
{
printf(" ");
}
for(j=4;j>=i;j--)
{
// textcolor(0-i);
printf(" %d",i);
}
printf("\n");
}


for(i=1;i<=4;i++)
{
for(j=1;j<=i;j++)
{
printf(" ");
}

for(k=4;k>=i;k--)
{
printf("%d ",i);
}
for(k=4;k>=i;k--)
{
printf(" %d",i);
}
printf("\n");
}



getch();
}

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain what is the difference between functions getch() and getche()?

591


Why can arithmetic operations not be performed on void pointers?

581


A collection of functions,calls,subroutines or other data a) library b) header files c) set of files d) textfiles

632


Why c is called object oriented language?

571


What is #define used for in c?

601






write a C program: To search a file any word which starts with ?a?. If the word following this ?a? starts with a vowel.Then replace this ?a? with ?a? with ?an?. redirect with the output onto an output file.The source file and destination file are specified by the user int the command line.

2441


exit () is used to a) exit () terminates the execution of the program itself b) exit () terminates the execution of the loop c) exit () terminates the execution of the block d) none of the above

652


What is meant by initialization and how we initialize a variable?

575


Differentiate fundamental data types and derived data types in C.

602


How do you define CONSTANT in C?

640


What are pointers really good for, anyway?

604


How can I split up a string into whitespace-separated fields?

556


What does != Mean in c?

575


Does free set pointer to null?

543


What does %2f mean in c?

662