This is a C Program which prints thee palindrome triangle based on the input given.
Here , check each row elements , you can see a palindrome sequence.
Palindrome Traingle |
PROGRAM :
#include <stdio.h> #include <stdlib.h> int main() { int i,j,n; printf("Enter number of lines[height of triangle] : \t"); scanf("%d",&n); for(i=1; i<=n; i++) { for(j=i; j<n; j++) printf(" "); for(j=1; j<=i; j++) printf("%d",j); for(j=i-1; j>=1; j--) printf("%d",j); printf("\n"); } return 0; }
OUTPUT :
C Program to print PalindromeTraingle |
No comments:
Post a Comment