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 pointers in C? Give an example where to illustrate their significance.
Difference between malloc() and calloc() function?
What is the difference between call by value and call by reference in c?
Can a local variable be volatile in c?
I have a varargs function which accepts a float parameter?
Differentiate between static and dynamic modeling.
Explain what are header files and explain what are its uses in c programming?
What is c++ used for today?
What is use of null pointer in c?
Explain how do you sort filenames in a directory?
Tell us bitwise shift operators?
What is the condition that is applied with ?: Operator?
What is use of integral promotions in c?
What is sorting in c plus plus?
What is the difference between text files and binary files?