how can i get output the following...
5 4 3 2 1
4 3 2 1
3 2 1
2 1
1
and
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
plz plz...
Answer Posted / aditi
For first one:-
void main ()
{
for (int i= 5; i>= 1; i--)
{
for (int k=5; k >= 1; k--)
{
if (k> i)
printf(" ");
else
printf ("%d", k);
}
printf("\n");
}
}
For second:-
void main ()
{
int n = 0;
for (int i=1; i<6; i++)
{
for (int k=1; k <= i; k++)
{
n = n +1;
printf ("%d ", n);
}
printf("\n");
}
}
| Is This Answer Correct ? | 12 Yes | 1 No |
Post New Answer View All Answers
What is difference between structure and union with example?
What is a void * in c?
What is 02d in c?
How can you draw circles in C?
What is the use of c language in real life?
What is scope of variable in c?
What standard functions are available to manipulate strings?
What is the advantage of using #define to declare a constant?
how to print electricity bill according to following charges first 100 units -1rs per unit for next 200 units-1.50 rs per unit without using conditions
What is volatile keyword in c?
What are the applications of c language?
What is static memory allocation? Explain
Who developed c language?
Do pointers need to be initialized?
What is pass by value in c?