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
What is the newline escape sequence?
Do you know what are bitwise shift operators in c programming?
i got 75% in all semester am i eligible for your company
Do pointers take up memory?
What is the difference between printf and scanf in c?
What would happen to X in this expression: X += 15; (assuming the value of X is 5)
What is the function of this pointer?
What is time null in c?
simple program of graphics and their output display
Why should I use standard library functions instead of writing my own?
What is meant by int main ()?
What is the difference between specifying a constant variable like with constant keyword and #define it? i.e what is the difference between CONSTANT FLOAT A=1.25 and #define A 1.25
Where static variables are stored in memory in c?
Write the Program to reverse a string using pointers.
What is sizeof return in c?