i want the code for printing the output as follows
4 4
3 3
2 2
1 1
0
1 1
2 2
3 3
4 4
Answers were Sorted based on User's Feedback
#include<stdio.h>
#include<conio.h>
void main()
{
int m,i,j;
printf("enter the max. number for the series :");
scanf("%d",&m);
for(i=m;i<=0;i--)
{
for(j=0;j<m-i;j++)
printf(" ");
printf("%d",i);
for(j=1;j<=(2*m-(m-i+1+(m-i)));j++)
printf(" ");
printf("%d",i);
printf("\n");
}
i++;
j=m-1;
for(;i<=m;i++)
{
for(;j>(m-i);j--)
printf(" ");
printf("%d",i);
for(j=1;j<(2*i);j++)
printf(" ");
printf("%d",i);
printf("\n");
}
getch();
}
thank u
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / shafi dayatar
#include<stdio.h>
int main(){
int i=0,j=0;
for(i=0;i<9;i++){
for(j=0;j<9;j++){
if( i==j || i+j==8)
if(i<=4)
printf("%d",4-i);
else
printf("%d",i-4);
else
printf(" ");
}
printf("\n");
}
return 0;
}
| Is This Answer Correct ? | 1 Yes | 0 No |
nic scientist exam
When should a type cast be used?
An application package has been provided to you without any documents for the following application. The application needs to be tested. How will you proceed?
though sbi was nationalized why its not comes under nationalized banks and its comes under publicsector banks
3 Answers State Bank Of India SBI,
Write a program or provide a pseudo code to flip the 2nd bit of the 32 bit number ! (Phone Screen)
Do you know the difference between exit() and _exit() function in c?
how to find anagram without using string functions using only loops in c programming
What is macro?
What does malloc () calloc () realloc () free () do?
What is difference between static and global variable in c?
How can I use a preprocessorif expression to ?
write a C and C++ programme to implement the A,bubble sort B,quick sort C,insertion sort D,sequential search E,binary search