print the following using nested for loop.
5 4 3 2 1
1 2 3 4
3 2 1
1 2
1
2 1
1 2 3
4 3 2 1
1 2 3 4 5
Answer Posted / anand.dayalan@gmail.com
#include<stdio.h>
#include<conio.h>
void main()
{
for(int i=1; i<=2; i++)
for(int j=(i==1)?1:2;j<=5;j++)
{
for(int k = (j%2==1 && i==1)? 5 + 1 -j: (j%2==0 && i==2)?
j:1; (j%2==1 && i==1)? k>=1: (j%2==0 && i==2)? k>=1:(j%2==0
&& i==1)?k<=5 + 1 -j:k<=j ;(j%2==1 && i==1)? k--: (j%2==0 &&
i==2)? k--:k++)
printf("%d", k);
printf("\n");
}
}
| Is This Answer Correct ? | 4 Yes | 1 No |
Post New Answer View All Answers
Why do we use pointer to pointer in c?
What does %d do in c?
What do you mean by keywords in c?
Differentiate between full, complete & perfect binary trees.
number of times a digit is present in a number
Why use int main instead of void main?
Why is c called c not d or e?
What is dynamic variable in c?
How many levels deep can include files be nested?
What is the use of sizeof () in c?
What is difference between array and pointer in c?
In c programming typeing to occupy the variables in memory space. if not useing the variable the memory space is wasted.ok, how to avoid the situation..? (the variable is used & notused)
What is operator precedence?
What are the 4 types of organizational structures?
What are the data types present in c?