1 1
12 21
123 321
12344231 how i creat it with for loop??
Answer Posted / 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 View All Answers
How can I delete a file?
How do you convert a decimal number to its hexa-decimal equivalent.Give a C code to do the same
What does do in c?
What are local static variables? How can you use them?
Can variables be declared anywhere in c?
Explain how do you override a defined macro?
What is difference between structure and union in c programming?
List the variables are used for writing doubly linked list program.
What oops means?
What is hungarian notation? Is it worthwhile?
What should malloc(0) do?
write a program to reverse a every alternetive words in a string in a place. EX: Input is "this is the line of text" Output should be "shit is eht line fo text" Please any one tell me code for that.
Under what circumstances does a name clash occur?
Write a program to input the price of 1 burger and the number of burgers eaten by a group of friends .print the total amount to be paid by the group?
Difference between exit() and _exit() function?