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 an operator?
Tell us two differences between new () and malloc ()?
What is pivot in c?
What's the total generic pointer type?
What are the __date__ and __time__ preprocessor commands?
Is it possible to initialize a variable at the time it was declared?
Where are some collections of useful code fragments and examples?
Does c have an equivalent to pascals with statement?
What are the differences between Structures and Arrays?
What is operator promotion?
What are the features of c languages?
What happens if header file is included twice?
What is exit() function?
Why c is procedure oriented?
difference between Low, Middle, High Level languages in c ?