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 does 2n 4c mean?
What is c programming structure?
Explain what is the difference between text files and binary files?
How arrays can be passed to a user defined function
How to write a multi-statement macro?
Which programming language is best for getting job 2020?
Write the test cases for checking a variable having value in range -10.0 to +10.0?
Explain can you assign a different address to an array tag?
Why is c known as a mother language?
If the size of int data type is two bytes, what is the range of signed int data type?
What is malloc calloc and realloc in c?
Why is extern used in c?
Explain high-order bytes.
#include show(int t,va_list ptr1) { int a,x,i; a=va_arg(ptr1,int) printf(" %d",a) } display(char) { int x; listptr; va_star(otr,s); n=va_arg(ptr,int); show(x,ptr); } main() { display("hello",4,12,13,14,44); }
What are the modifiers available in c programming language?