Created
November 5, 2013 10:33
-
-
Save Codeplaza/7317026 to your computer and use it in GitHub Desktop.
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>/*calling the header files*/ | |
| int main() | |
| { | |
| int i,j,k,n; /*intializing the variables which are needed*/ | |
| printf("Please enter the rows for the right andled triangle \n"); | |
| scanf("%d",&n); | |
| /*Loop for the uppart part of the pattern*/ | |
| for(i=n;i>=1;i--) | |
| { | |
| for(j=1;j<=i;j++) | |
| { | |
| printf("*"); | |
| } | |
| for(k=n;k>i;k--) | |
| { | |
| printf(" "); | |
| } | |
| for(j=1;j<=i;j++) | |
| { | |
| printf("*"); | |
| } | |
| printf("\n"); | |
| } | |
| /*loop for lower part */ | |
| for(i=2;i<=n;i++) | |
| { | |
| for(j=1;j<=i;j++) | |
| { | |
| printf("*"); | |
| } | |
| for(k=i;k<n;k++) | |
| { | |
| printf(" "); | |
| } | |
| for(j=1;j<=i;j++) | |
| { | |
| printf("*"); | |
| } | |
| printf("\n"); | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment