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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

1. Write a function to display the sum of two numbers in the following ways: By using (i) pass by value (ii) pass by address a. function with argument and with return value b. function with argument and without return value c. without argument , with return value d. without argument , without return value Note: Use pass by address.

2328


void main(){ int a; a=1; while(a-->=1) while(a-->=0); printf("%d",a); }

1251


What is Dynamic memory allocation in C? Name the dynamic allocation functions.

551


what does static variable mean?

645


Why is extern used in c?

609






Are pointers really faster than arrays?

554


How do I get an accurate error status return from system on ms-dos?

639


What are the advantages of the functions?

600


How does #define work?

642


What is output redirection?

682


What is identifiers in c with examples?

671


Explain argument and its types.

592


Why is not a pointer null after calling free?

587


What the advantages of using Unions?

667


What is s or c?

589