write a program to display the numbers in the following
4 4
3 3
2 2
1 1
0
1 1
2 2
3 3
4 4
Answer Posted / vidyullatha
#include<stdio.h>
main()
{
int i,j,k,l;
int space=7;
for(i=4;i>=0;i--)
{
for(j=4;j>i;j--)
{
printf(" ");
}
printf("%d ",i);
for(j=0;j<space;j++)
{
printf(" ");
}
if(space>0)
printf("%d ",i);
space = space-2;
printf("\n");
}
space = 1;
for(i=1;i<=4;i++)
{
for(j=4;j>i;j--)
{
printf(" ");
}
printf("%d ",i);
for(j=0;j<space;j++)
{
printf(" ");
}
printf("%d ",i);
space = space+2;
printf("\n");
}
}
| Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
What is the main difference between calloc () and malloc ()?
A banker has a seif with a cipher. Not to forget the cipher, he wants to write it coded as following: each digit to be replaced with the difference of 9 with the current digit. The banker chose a cipher. Decipher it knowing the cipher starts with a digit different than 9. I need to write a program that takes the cipher from the keyboard and prints the new cipher. I thought of the following: Take the input from the keyboard and put it into a string or an array. Go through the object with a for and for each digit other than the first, substract it from 9 and add it to another variable. Print the new variable. Theoretically I thought of it but I don't know much C. Could you give me any kind of hint, whether I am on the right track or not?
Is main an identifier in c?
Explain how do you use a pointer to a function?
WRITE A PROGRAM TO MERGE TWO SORTED ARRAY USING MERGE SORT TECHNIQUE..
What is the equivalent code of the following statement in WHILE LOOP format?
Explain what does the function toupper() do?
How do shell structures work?
Which is better oop or procedural?
i have to apply for the rbi for the post of officers. i need to know abt the entrance questions whether it may be aps or techinical....
What is c language in simple words?
What is conio h in c?
What is function in c with example?
write a proram to reverse the string using switch case?
What is the difference between abs() and fabs() functions?