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

List some of the dynamic data structures in C?

0 Answers  


code for copying two strings with out strcpy() function.

6 Answers  


how to find string length wihtout using c function?

6 Answers  


how to count no of words,characters,lines in a paragraph.

0 Answers  


what is the output of following question? void main() { int i=0,a[3]; a[i]=i++; printf("%d",a[i] }

3 Answers  






I want tcs placement papers of 2004-2009 , its urgent

6 Answers   TCS, Wipro,


What is meant by type casting?

0 Answers  


What are preprocessor directives?

0 Answers  


Difference between C and Embedded C?

1 Answers  


consider the following C code main() { int i=3,x; while(i>0) { x=func(i); i--; } int func(int n) { static sum=0; sum=sum+n; return(sum); } the final value of x is

4 Answers   TCS,


What is %g in c?

0 Answers  


with out using main how to execute the program?

2 Answers  


Categories