1 1
12 21
123 321
12344231 how i creat it with for loop??



1 1 12 21 123 321 12344231 how i creat it with for loop??..

Answer / raju kalyadapu

#include<stdio.h>
#include<conio.h>
int main()
{
int i,j,k;
for(i=1;i<=4;i++) //Outer Loop
{
for(j=1;j<=4;j++) //Inner loop for left side pattern
{
if(j<=i) //condition for checking printing space or number
printf("%d",j);
else
printf(" ");

}


for(j=4;j>=1;j--) //Inner loop for right side pattern
{
if(j<=i) //condition for checking printing space or number
{
printf("%d",j);
}
else
printf(" ");

}
printf("
");

}
getch();
return 0;
}

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

what is the use of fflush() function?

2 Answers  


Explain how can a program be made to print the line number where an error occurs?

0 Answers  


In c programming language, how many parameters can be passed to a function ?

0 Answers  


What is the process to create increment and decrement stamen in c?

0 Answers  


int i=0,j; j=++i + ++i ++i; printf(" %d",j);

2 Answers   ME,






Read two numbers from keyboard and find maximum of them?

1 Answers  


What is the -> in c?

0 Answers  


What is conio h in c?

0 Answers  


1. What will be the output of the following programs. a) #include <stdio.h> Main() { Int x=4; While(x==1) { X=x-1; Printf(ā€œ%dā€,x); --x; } }

7 Answers   CSC,


What's the total generic pointer type?

0 Answers  


who is the editor of 'pokemon'?

1 Answers  


what is the difference between char * const and const char *?

2 Answers   TCS,


Categories