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 many bytes is a struct in c?
When should structures be passed by values or by references?
what does static variable mean?
number of times a digit is present in a number
write a program to find the given number is prime or not
What is file in c language?
What is static memory allocation? Explain
Explain what is the use of a semicolon (;) at the end of every program statement?
What is LINKED LIST? How can you access the last element in a linked list?
What was noalias and what ever happened to it?
Explain modulus operator. What are the restrictions of a modulus operator?
What is a wrapper function in c?
What is a stream in c programming?
What is null in c?
How can I implement a delay, or time a users response, with sub-second resolution?