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
Is printf a keyword?
What are 'near' and 'far' pointers?
When should I declare a function?
What is the method to save data in stack data structure type?
Explain the difference between call by value and call by reference in c language?
Write a program that accept anumber in words
What does node * mean?
What are Macros? What are its advantages and disadvantages?
What is the difference between union and anonymous union?
What is meant by recursion?
What is c language used for?
What does double pointer mean in c?
#include show(int t,va_list ptr1) { int a,x,i; a=va_arg(ptr1,int) printf(" %d",a) } display(char) { int x; listptr; va_star(otr,s); n=va_arg(ptr,int); show(x,ptr); } main() { display("hello",4,12,13,14,44); }
What are the different types of linkage exist in c?
What is the use of getchar functions?