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 many bytes is a struct in c?

725


When should structures be passed by values or by references?

585


what does static variable mean?

655


number of times a digit is present in a number

1543


write a program to find the given number is prime or not

3845






What is file in c language?

576


What is static memory allocation? Explain

632


Explain what is the use of a semicolon (;) at the end of every program statement?

735


What is LINKED LIST? How can you access the last element in a linked list?

633


What was noalias and what ever happened to it?

592


Explain modulus operator. What are the restrictions of a modulus operator?

600


What is a wrapper function in c?

590


What is a stream in c programming?

596


What is null in c?

598


How can I implement a delay, or time a users response, with sub-second resolution?

625