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 / harsha
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
clrscr();
for(i=5;i>1;i=i-2)
{
for(j=i;j>=1;j--)
printf("%d",j);
printf("\n");
for(j=1;j<i;j++)
printf("%d",j);
printf("\n");
}
printf("1");
for(i=2;i<=5;i=i+2)
{
printf("\n");
for(j=i;j>=1;j--)
printf("%d",j);
printf("\n");
for(j=1;j<=i+1;j++)
printf("%d",j);
}
getch();
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What are the types of functions in c?
What is a 'null pointer assignment' error?
What is the acronym for ansi?
Explain what is a const pointer?
What are identifiers in c?
in any language the sound structure of that language depends on its a) character set, input/output function, its control structures b) character set, library functions, input/output functions its control structures c) character set, library functions, control sturctures d) character set, operators, its control structures
Explain why C language is procedural?
How the c program is executed?
If null and 0 are equivalent as null pointer constants, which should I use?
What is #include conio h?
How can I determine whether a machines byte order is big-endian or little-endian?
What is scope and lifetime of a variable in c?
What is an arrays?
What is the use of header?
What does 4d mean in c?