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 are global variables and how do you declare them?
What does it mean when a pointer is used in an if statement?
Is c weakly typed?
Why void is used in c?
What is the use of header?
When is the “void” keyword used in a function?
What are the standard predefined macros?
Explain what will the preprocessor do for a program?
What are directives in c?
Can we declare a function inside a function in c?
What are the main characteristics of c language describe the structure of ac program?
Explain the difference between malloc() and calloc() in c?
What are enums in c?
what are enumerations in C
What is return type in c?