Created
November 13, 2016 17:54
-
-
Save akshay-kumar-goel/2b4493601bb3056f301b366c102dab0e to your computer and use it in GitHub Desktop.
Trishul pattern in c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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