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
Do array subscripts always start with zero?
How can I sort more data than will fit in memory?
What is the description for syntax errors?
Can you please explain the difference between exit() and _exit() function?
program to find error in linklist.(i.e find whether any node point wrongly to previous nodes instead of next node)
Explain what is a program flowchart and explain how does it help in writing a program?
What are disadvantages of C language.
Is fortran faster than c?
Explain how can a program be made to print the name of a source file where an error occurs?
Explain how can type-insensitive macros be created?
What is the difference between variable declaration and variable definition in c?
Why do we use null pointer?
What is the difference between a string and an array?
Can the size of an array be declared at runtime?
What is c standard library?