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
What is function and its example?
What does calloc stand for?
How do you define a function?
What language is c written?
How can a program be made to print the line number where an error occurs?
What is the difference between procedural and declarative language?
Is c is a low level language?
C program execution always begins with a) #include b) comment (/*-------*/) c) main() d) declaration instructions
Where in memory are my variables stored?
What is #define size in c?
write a program using linked list in which each node consists of following information. Name[30] Branch Rollno Telephone no i) Write the program to add information of students in linked list
Which driver is a pure java driver
typedef struct{ char *; nodeptr next; } * nodeptr ; What does nodeptr stand for?
What is malloc calloc and realloc in c?
What are variables c?