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 a buffer in c?
Is javascript written in c?
Can you think of a logic behind the game minesweeper.
if a is an integer variable, a=5/2; will return a value a) 2.5 b) 3 c) 2 d) 0
Why we use void main in c?
How many types of errors are there in c language? Explain
What is volatile variable in c?
How old is c programming language?
What is chain pointer in c?
write a program to display all prime numbers
Is it possible to execute code even after the program exits the main() function?
How can I do peek and poke in c?
Do you have any idea how to compare array with pointer in c?
#define f(g,h) g##h main O int i=0 int var=100 ; print f ("%d"f(var,10));} wat would be the output??
Which built-in library function can be used to match a patter from the string?