1
1 2
1 2 3
1 2 3 4
1 2 3
1 2
1
generate this output using for loop
Answer Posted / varsha shukla
#include<conio.h>
#include<stdio.h>
void main()
{
int i,j,k,l;
for(i=1;i<=4;i++)
{
for(k=i;k<=4;k++)
{
printf(" ");
}
for(j=1;j<=i;j++)
{
printf(" %d",j);
}
printf("\n");
}
for(i=3;i>0;i--)
{
for(l=i;l<=3;l++)
{
printf(" ");
}
for(j=1;j<=i;j++)
{
printf(" %d",j);
}
printf("\n");
}
getch();
| Is This Answer Correct ? | 4 Yes | 1 No |
Post New Answer View All Answers
How are variables declared in c?
Explain what is output redirection?
Is c high or low level?
Why pointers are used in c?
Explain what is dynamic data structure?
can we have joblib in a proc ?
What is wrong with this program statement?
Define the scope of static variables.
What are enumerated types?
Do array subscripts always start with zero?
How can I sort a linked list?
A function can make the value of a variable available to another by a) declaring the variable as global variable b) Passing the variable as a parameter to the second function c) Either of the two methods in (A) and (B) d) binary stream
provide an example of the Group by clause, when would you use this clause
Why doesnt this code work?
How do you initialize pointer variables?