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


Please Help Members By Posting Answers For Below Questions

How do we declare variables in c?

561


What is #include stdio h?

678


What is a constant?

626


What are different storage class specifiers in c?

611


Why are algorithms important in c program?

614






Is main is user defined function?

588


What is function prototype in c with example?

570


Explain is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?

669


what is the diffrenet bettwen HTTP and internet protocol

1383


What is a static variable in c?

663


What is a structure member in c?

539


How do you write a program which produces its own source code as output?

603


Describe the steps to insert data into a singly linked list.

618


What is the best organizational structure?

637


How many bytes are occupied by near, far and huge pointers (dos)?

664