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
Explain what is the difference between functions getch() and getche()?
Why can arithmetic operations not be performed on void pointers?
A collection of functions,calls,subroutines or other data a) library b) header files c) set of files d) textfiles
Why c is called object oriented language?
What is #define used for in c?
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.
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
What is meant by initialization and how we initialize a variable?
Differentiate fundamental data types and derived data types in C.
How do you define CONSTANT in C?
What are pointers really good for, anyway?
How can I split up a string into whitespace-separated fields?
What does != Mean in c?
Does free set pointer to null?
What does %2f mean in c?