/* Pattern Printing in C */
#include<stdio.h>
#include<conio.h>
int main()
{
int i,j;
for(i=1;i<=5;i++)
{
for(j=5;j>=i;j--)
{
printf("* \t");
}
printf("\n");
}
return 0;
}
Output :
Equivalent Code:
--------------------
/* Pattern Printing in C */
#include<stdio.h>
#include<conio.h>
int main()
{
int i,j;
for(i=5;i>=1;i--)
{
for(j=1;j<=i;j++)
{
printf("* \t");
}
printf("\n");
return 0;
}
Output:
I have used Dev CPP to compile this program.
If you are using Turbo C++ IDE, then use conio.h in link section after stdio.h
and use getch(); to hold the output screen, just before the end of main function.
If you have any confusion regarding the program, please, comment below.
Happy Coding !
Thank you
Home / Looping in C /
Nested Loop in C /
Pattern Printing in C /
Pattern programs in C
/ Pattern Printing in C Programming I
- Blogger Comment
- Facebook Comment
Subscribe to:
Post Comments
(
Atom
)
0 comments:
Post a Comment