Search This Blog
Welcome to 1printf(), your ultimate destination for C, C++, Linux, Data Structures, and Microcontroller programming! π πΉLearn advanced coding techniques in C& C++ πΉMaster Linux internals & shell scripting πΉDeep dive into Data Structures & Algorithms πΉExplore Embedded Systems & Microcontrollers (8051,UART, RTOS) πΉGet hands-on coding tutorials, project ideas,and interview preparation tips Whether you're a beginner or an experienced programmer, this channel will help you
Featured
- Get link
- X
- Other Apps
C Triangle Pattern Programs 7: Star, Number, Alphabet & Binary Patterns with Output
Half Diamond Alphabet Series Pattern Program in C
This C program prints a Half Diamond Alphabet Series Pattern
using nested for loops. In each row, the alphabets start from
A and continue sequentially up to the current column. The
pattern is then printed in reverse order to form a half diamond shape.
✅ C Program Code
#include<stdio.h>
int main()
{
int num, k = 0;
printf("Enter the number:\n");
scanf("%d",&num);
// Upper Half
for(int i = 1; i <= num; i++)
{
for(int j = 1; j <= i; j++)
{
printf("%c ", j + 64);
}
printf("\n");
}
// Lower Half
for(int i = num; i >= 1; i--)
{
for(int j = 1; j <= i; j++)
{
printf("%c ", j + 64);
}
printf("\n");
}
return 0;
}
π‘ Explanation
- The program accepts the number of rows from the user.
- The first nested
forloop prints the upper half of the pattern. - The expression
j + 64converts the column number into its corresponding uppercase ASCII character:1 + 64 = 65 → A2 + 64 = 66 → B3 + 64 = 67 → C4 + 64 = 68 → D
- Each row starts with A and continues alphabetically up to the current column number.
- The second nested
forloop prints the same pattern in reverse order, forming a Half Diamond Alphabet Series Pattern.
π» Sample Output
⏱ Time Complexity
O(n²)
πΎ Space Complexity
O(1)
π Conclusion
This program demonstrates how nested for loops and ASCII values can
be used to generate a Half Diamond Alphabet Series Pattern. It is an excellent
example for beginners to understand character manipulation, nested loops, and
alphabet pattern printing in C.
π Keywords
Half Diamond Alphabet Series Pattern in C, Alphabet Pattern Program in C, ABC Pattern in C, Character Pattern Using ASCII, ASCII Alphabet Pattern, Half Diamond Character Pattern, Nested Loops in C, Pattern Printing Programs in C, C Programming Alphabet Patterns, Alphabet Series Pattern Using For Loop
Half Diamond Alphabet Pattern Program in C
This C program prints a Half Diamond Alphabet Pattern using
nested for loops. Each row prints the corresponding uppercase
alphabet repeatedly. The expression i + 64 converts the row number
into its equivalent ASCII uppercase letter, and the pattern is then printed in
reverse order to form a half diamond.
✅ C Program Code
#include<stdio.h>
int main()
{
int num, k = 0;
printf("Enter the number:\n");
scanf("%d",&num);
// Upper Half
for(int i = 1; i <= num; i++)
{
for(int j = 1; j <= i; j++)
{
printf("%c ", i + 64);
}
printf("\n");
}
// Lower Half
for(int i = num; i >= 1; i--)
{
for(int j = 1; j <= i; j++)
{
printf("%c ", i + 64);
}
printf("\n");
}
return 0;
}
π‘ Explanation
- The program accepts the number of rows from the user.
- The first nested
forloop prints the upper half of the pattern. - The expression
i + 64converts the row number into its corresponding uppercase ASCII character:1 + 64 = 65 → A2 + 64 = 66 → B3 + 64 = 67 → C4 + 64 = 68 → D
- Each row prints the same alphabet character repeatedly according to the row number.
- The second nested
forloop prints the same pattern in reverse order, creating a Half Diamond Alphabet Pattern.
π» Sample Output
⏱ Time Complexity
O(n²)
πΎ Space Complexity
O(1)
π Conclusion
This program demonstrates how nested for loops and ASCII values can
be used to generate a Half Diamond Alphabet Pattern in C. It is an excellent
practice program for learning nested loops, character manipulation, and pattern
printing using uppercase alphabets.
π Keywords
Half Diamond Alphabet Pattern in C, Alphabet Pattern Program in C, Character Pattern in C, ASCII Pattern Program, Uppercase Letter Pattern in C, Half Diamond Character Pattern, Nested Loops in C, Pattern Printing Programs in C, ASCII Value Program in C, C Programming Alphabet Patterns
Half Diamond Continuous Number Pattern Program in C
This C program prints a Half Diamond Continuous Number Pattern
using nested for loops. A variable k is initialized to
0 and is incremented after every print operation, resulting in a
continuous sequence of numbers throughout both the upper and lower halves of
the pattern.
✅ C Program Code
#include<stdio.h>
int main()
{
int num, k = 0;
printf("Enter the number:\n");
scanf("%d",&num);
// Upper Half
for(int i = 1; i <= num; i++)
{
for(int j = 1; j <= i; j++)
{
printf("%d ", k++);
}
printf("\n");
}
// Lower Half
for(int i = num; i >= 1; i--)
{
for(int j = 1; j <= i; j++)
{
printf("%d ", k++);
}
printf("\n");
}
return 0;
}
π‘ Explanation
- The program accepts the number of rows from the user.
- The variable
kis initialized to0. - The first nested
forloop prints the upper half of the pattern. - Each time
printf("%d ", k++)executes, the current value ofkis printed, and thenkis increased by1. - The second nested
forloop prints the lower half while continuing the sequence without resettingk. - As a result, the pattern displays continuous numbers in the shape of a half diamond.
π» Sample Output
⏱ Time Complexity
O(n²)
πΎ Space Complexity
O(1)
π Conclusion
This program demonstrates how nested for loops and a continuously
incrementing variable can be used to generate a Half Diamond Continuous Number
Pattern. It is an excellent example for beginners to understand nested loops,
post-increment operators, and sequential number pattern generation in C.
π Keywords
Half Diamond Continuous Number Pattern in C, Continuous Number Pattern in C, Number Pattern Program in C, Sequential Number Pattern, Half Diamond Pattern Using Numbers, Nested Loops in C, Pattern Printing Programs in C, C Programming Examples, Increment Operator in C, Number Pattern Using For Loop
Half Diamond Row Binary Pattern Program in C
This C program prints a Half Diamond Row Binary Pattern using
nested for loops. Instead of alternating values in every column,
the program prints the same binary digit throughout each row based on the
expression i % 2. Odd-numbered rows print 1, while
even-numbered rows print 0. The pattern is then repeated in
reverse order to form a half diamond.
✅ C Program Code
#include<stdio.h>
int main()
{
int num;
printf("Enter the number:\n");
scanf("%d",&num);
// Upper Half
for(int i=1;i<=num;i++)
{
for(int j=1;j<=i;j++)
{
printf("%d ",i%2);
}
printf("\n");
}
// Lower Half
for(int i=num;i>=1;i--)
{
for(int j=1;j<=i;j++)
{
printf("%d ",i%2);
}
printf("\n");
}
return 0;
}
π‘ Explanation
- The program reads the number of rows from the user.
- The first nested
forloop prints the upper half of the pattern. - The expression
i % 2determines the value printed in each row:- Odd rows print 1.
- Even rows print 0.
- Every element in the same row has the same value because the row number
iremains constant. - The second nested
forloop prints the same pattern in reverse order, creating a Half Diamond Row Binary Pattern.
π» Sample Output
⏱ Time Complexity
O(n²)
πΎ Space Complexity
O(1)
π Conclusion
This program demonstrates how the modulo operator (%) and nested
for loops can be used to generate a Half Diamond Row Binary
Pattern. It helps beginners understand row-based pattern generation, nested
loops, and the use of the modulo operator in C programming.
π Keywords
Half Diamond Row Binary Pattern in C, Binary Pattern Program in C, Row Wise Binary Pattern in C, 0 and 1 Pattern in C, Half Diamond Pattern Using Binary Numbers, Nested Loops in C, Pattern Printing Programs in C, C Programming Examples, Modulo Operator Pattern in C, Row Based Binary Pattern in C
Half Diamond Binary Pattern Program in C
This C program prints a Half Diamond Binary Pattern using nested
for loops. The program prints alternating 1 and
0 values in each row by using the expression j % 2.
The upper half prints the pattern in increasing order, while the lower half
prints it in decreasing order to form a half diamond.
✅ C Program Code
#include<stdio.h>
int main()
{
int num;
printf("Enter the number:\n");
scanf("%d",&num);
// Upper Half
for(int i=1;i<=num;i++)
{
for(int j=1;j<=i;j++)
{
printf("%d ",j%2);
}
printf("\n");
}
// Lower Half
for(int i=num;i>=1;i--)
{
for(int j=1;j<=i;j++)
{
printf("%d ",j%2);
}
printf("\n");
}
return 0;
}
π‘ Explanation
- The program accepts the number of rows from the user.
- The first nested
forloop prints the upper half of the binary pattern. - The expression
j % 2prints alternating values:1 % 2 = 12 % 2 = 03 % 2 = 14 % 2 = 0
- The second nested
forloop prints the same binary pattern in reverse order. - Combining both parts creates a Half Diamond Binary Pattern.
π» Sample Output
⏱ Time Complexity
O(n²)
πΎ Space Complexity
O(1)
π Conclusion
This program demonstrates how nested for loops and the modulo
operator (%) can be used to generate a Half Diamond Binary Pattern.
It is a useful practice program for beginners to understand nested loops,
alternating sequences, and pattern printing in C.
π Keywords
Half Diamond Binary Pattern in C, Binary Pattern Program in C, 0 and 1 Pattern in C, Half Diamond Pattern Using Binary Numbers, Nested Loops in C, Pattern Printing in C, C Programming Pattern Examples, Modulo Operator Pattern in C, Alternating Binary Pattern in C
Half Diamond Number Pattern Program in C
This C program prints a Half Diamond Number Pattern using nested
for loops. The upper half prints the row number repeatedly in each
row, while the lower half prints the same pattern in reverse order to create a
half diamond shape.
✅ C Program Code
#include<stdio.h>
int main()
{
int num;
printf("Enter the number:\n");
scanf("%d",&num);
// Upper Half
for(int i=1;i<=num;i++)
{
for(int j=1;j<=i;j++)
{
printf("%d ",i);
}
printf("\n");
}
// Lower Half
for(int i=num;i>=1;i--)
{
for(int j=1;j<=i;j++)
{
printf("%d ",i);
}
printf("\n");
}
return 0;
}
π‘ Explanation
- The program accepts the number of rows from the user.
- The first nested
forloop prints the upper half of the pattern by repeating the current row number in each row. - The second nested
forloop prints the lower half by decreasing the row number fromnumto1. - Together, both loops create a Half Diamond Number Pattern.
π» Sample Output
⏱ Time Complexity
O(n²)
πΎ Space Complexity
O(1)
π Conclusion
This program demonstrates how nested for loops can be used to print
a Half Diamond Number Pattern by repeating the current row number. It is an
excellent practice program for beginners to understand nested loops and pattern
printing techniques in C.
π Keywords
Half Diamond Number Pattern in C, Number Pattern Program in C, Half Diamond Pattern Using Numbers, Nested Loops in C, Pattern Printing Programs in C, C Number Patterns, Beginner C Programming Examples, Number Pattern Using For Loop
Half Diamond Star Pattern Program in C
This C program prints a Half Diamond Star Pattern using nested
for loops. It first prints the stars in increasing order and then
prints them in decreasing order to create a half diamond shape.
✅ C Program Code
#include<stdio.h>
int main()
{
int num;
printf("Enter the number:\n");
scanf("%d",&num);
// Upper Half
for(int i=1;i<=num;i++)
{
for(int j=1;j<=i;j++)
{
printf("* ");
}
printf("\n");
}
// Lower Half
for(int i=num;i>=1;i--)
{
for(int j=1;j<=i;j++)
{
printf("* ");
}
printf("\n");
}
return 0;
}
π‘ Explanation
- The program accepts the number of rows from the user.
- The first nested
forloop prints the upper half of the pattern by increasing the number of stars in each row. - The second nested
forloop prints the lower half by decreasing the number of stars in each row. - Together, both loops form a Half Diamond Star Pattern.
π» Sample Output
⏱ Time Complexity
O(n²)
πΎ Space Complexity
O(1)
π Conclusion
This program demonstrates how nested for loops can be used to
print a Half Diamond Star Pattern. It is a beginner-friendly example for
understanding nested loops, pattern printing, and loop control in C.
π Keywords
Half Diamond Star Pattern in C, Star Pattern Program in C, Half Pyramid Pattern in C, Nested Loops in C, Pattern Printing Programs, C Programming Examples, Beginner C Programs, Star Pattern Using For Loop
Full Diamond Number Pattern in C
This C program prints a full diamond-like number pattern using nested for loops. It starts by printing numbers in increasing order and then prints them in decreasing order to form a symmetric structure.
✅ C Program Code:
#include <stdio.h>
int main()
{
int num;
printf("Enter the number:\n");
scanf("%d", &num);
// Top half
for (int i = 1; i <= num; i++)
{
for (int j = 1; j <= i; j++)
{
printf("%d ", j);
}
printf("\n");
}
// Bottom half
for (int i = num; i >= 1; i--)
{
for (int j = 1; j <= i; j++)
{
printf("%d ", j);
}
printf("\n");
}
}
π‘ Explanation:
- The first
forloop builds the upper part of the diamond using increasing rows. - The second
forloop mirrors the top by printing decreasing rows. - Each row prints numbers from 1 up to the current row index.
π» Sample Output:
3
1
1 2
1 2 3
1 2 3
1 2
1
π Keywords:
Diamond number pattern in C, number pyramid in C, full pyramid C pattern, nested loops example in C, beginner pattern programs, mirror pyramid C
Popular Posts
C++ Program for Hybrid Inheritance (All Types Together)
- Get link
- X
- Other Apps
C++ Program for Function Overloading Example
- Get link
- X
- Other Apps

Comments
Post a Comment