1. To Print Butterfly Pattern using loops
Solution:
#include <stdio.h>
int main()
{
int i,j,n;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=1;j<=2*n;j++)
{
if(i<j)
printf(" ");
else
printf("&");
if(i<=2*n-j)
printf(" ");
else
printf("&");
}
printf("\n");
}
for(i=1;i<=n;i++)
{
for(j=1;j<=2*n;j++)
{
if(i>(n-j+1))
printf(" ");
else
printf("&");
if((i+n)>j)
printf(" ");
else
printf("*");
}
printf("\n");
}
return 0;
}
thank u for sharing this post
ReplyDeleteswitching solutions companies
meraki switches
ReplyDeletethank u for sharing this post Meraki Firewall
Meraki Cloud