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

Between macros and functions,which is better to use and why?

1570


Explain what will the preprocessor do for a program?

605


What will be the outcome of the following conditional statement if the value of variable s is 10?

767


What is a pointer value and address in c?

636


In C programming, what command or code can be used to determine if a number of odd or even?

622






What is %lu in c?

687


What is indirection? How many levels of pointers can you have?

659


What are different types of pointers?

563


#include #include struct stu { int i; char j; }; union uni { int i; char j; }; void main() { int j,k; clrscr(); struct stu s; j=sizeof(s); printf("%d",j); union uni u; k=sizeof(u); printf("%d",k); getch(); } what is value of j and k.

5209


What is c system32 taskhostw exe?

593


Should a function contain a return statement if it does not return a value?

598


Why can’t constant values be used to define an array’s initial size?

837


How do you list files in a directory?

563


Describe explain how arrays can be passed to a user defined function

605


Differentiate between static and dynamic modeling.

620