Final keyword in Java with example
Final keyword in Java with example Here you will know use of Final keyword in Java with example code in java programming. What is Final Keyword in Java? The […]
Final keyword in Java with example Here you will know use of Final keyword in Java with example code in java programming. What is Final Keyword in Java? The […]
C program for Recursive Binary & Linear Search Here you will get and learn the program for recursive binary & linear search using C programming language. How to Program
C++ Program to find the sum of odd digits of a number Here you get the example code to find the sum of odd digits of a number in C++
Program to find the sum of odd digits of a number in c++ Read More »
Hollow Pyramid Pattern Here you will learn to print a Hollow Pyramid Pattern in C programming language. Program Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | #include <stdio.h> int main() { int i,j,num; printf("Enter a Number to print Square Pattern : "); scanf("%d",&num); for (int i = 0; i < num; i++) { for (int j = 0; j < 2 * (num - i) - 1; j++) { printf(" "); } for (int k = 0; k < 2 * i + 1; k++) { if (k == 0 || k == 2 * i || i == num - 1) { printf("* "); } else { printf(" "); } } printf("\n"); } return 0; } |
Output
Hollow Square Pattern Here you will learn to print a Hollow Square Star Pattern in C programming language. Hollow square pattern program code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | #include <stdio.h> int main() { int i,j,num; printf("Enter a Number to print Square Pattern : "); scanf("%d",&num); for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { if (i > 0 && i < num - 1 && j > 0 && j < num - 1) { printf(" "); } else { printf("* "); } } printf("\n"); } return 0; } |
Output
Mirrored Right Triangle Star Pattern Here you will learn to print a Mirrored Right Triangle Star Pattern in C programming language. Program Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #include <stdio.h> int main() { int num,i,j; printf("Enter the number of rows: "); scanf("%d",&num); int m = 1; for(int i = num; i >= 1; i--) { for(int j = 1; j <= i - 1; j++) { printf(" "); } for(int k = 1; k <= m; k++) { printf("*"); } printf("\n"); m++; } return 0; } |
Output
Left Half Diamond Pattern Here you will learn to print a Left Half Diamond Pattern in C programming language. Program Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | #include <stdio.h> int main() { int i, j, k, num; printf("Enter the number of rows: "); scanf("%d", &num); for (i = 1; i <= num; i++) { for (j = i; j < num; j++) printf(" "); for (k = 1; k <= i; k++) printf("*"); printf("\n"); } for (i = num; i >= 1; i--) { for (j = i; j <= num; j++) printf(" "); for (k = 1; k < i; k++) printf("*"); printf("\n"); } return 0; } |
Output
Inverted Mirrored Right Triangle Here you will learn to print a Inverted Mirrored Right Triangle Star Pattern in C programming language. Program code of Inverted Mirrored Right Triangle star
Inverted Mirrored Right Triangle star Pattern in c Read More »
Half Diamond Pattern Here you will learn to print a Half Diamond Pattern using Stars in C programming. Program Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #include <stdio.h> int main() { int num,i,j; printf("Enter the number of rows: "); scanf("%d",&num); for(int i = 1; i <= num; i++) { for(int j = 1; j <= i; j++) { printf("* "); } printf("\n"); } for(int i = num - 1; i >= 1; i--) { for(int j = 1; j <= i; j++) { printf("* "); } printf("\n"); } return 0; } |
Output
Inverted Right Triangle Star Pattern Here you will learn to print a Inverted Right Triangle Star Pattern in C programming language. Program Code of Inverted Right Triangle Star Pattern
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #include <stdio.h> int main() { int i,j,num; printf("Enter the number of rows: "); scanf("%d",&num); for(int i = num; i >= 1; i--) { for(int j = 1; j <= i; j++) { printf("* "); } printf("\n"); } return 0; } |