Skip to content

Instantly share code, notes, and snippets.

@akshay-kumar-goel
Created November 13, 2016 17:54
Show Gist options
  • Save akshay-kumar-goel/2b4493601bb3056f301b366c102dab0e to your computer and use it in GitHub Desktop.
Save akshay-kumar-goel/2b4493601bb3056f301b366c102dab0e to your computer and use it in GitHub Desktop.
Trishul pattern in c
#include<stdio.h>
int main()
{
int i,j,k;
int h=7,t=3,l=5;
for(i=1;i<=(t/2)+1;i++)
{
for(j=1;j<=i;j++)
{
printf("*");
}
if(i==(t/2)+1)
{
for(i=1;i<=l+h-2;i++)
{
printf("*");
}
}
else
{
for(k=i+1;k<=((l+(t/2)+1));k++)
{ printf("-");
}
}
for(k=i;k<=h;k++)
{
printf("*");
}
printf("\n");
}
for(i=t/2;i>=1;i--)
{
for(j=1;j<=i;j++)
{
printf("*");
}
for(k=i+1;k<=((l+(t/2)+1));k++)
{
printf("-");
}
for(k=i;k<=h;k++)
{
printf("*");
}
printf("\n");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment