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
Differentiate between declaring a variable and defining a variable?
What does the function toupper() do?
How can I find out if there are characters available for reading?
What are the advantages of using new operator as compared to the function malloc ()?
What is the use of a conditional inclusion statement in C?
What is sizeof array?
Is fortran still used in 2018?
What are shell structures used for?
Are comments included during the compilation stage and placed in the EXE file as well?
What are header files? What are their uses?
write a program to generate address labels using structures?
What does c mean before a date?
Write a program to display all the prime nos from 1 to 1000000, your code should not take time more than a minute to display all the nos.
Is register a keyword in c?
What is extern keyword in c?