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 do we declare variables in c?
What is #include stdio h?
What is a constant?
What are different storage class specifiers in c?
Why are algorithms important in c program?
Is main is user defined function?
What is function prototype in c with example?
Explain is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?
what is the diffrenet bettwen HTTP and internet protocol
What is a static variable in c?
What is a structure member in c?
How do you write a program which produces its own source code as output?
Describe the steps to insert data into a singly linked list.
What is the best organizational structure?
How many bytes are occupied by near, far and huge pointers (dos)?