
- C Programming Tutorial
- C - Home
- C - Overview
- C - Environment Setup
- C - Program Structure
- C - Basic Syntax
- C - Data Types
- C - Variables
- C - Constants
- C - Storage Classes
- C - Operators
- C - Decision Making
- C - Loops
- C - Functions
- C - Scope Rules
- C - Arrays
- C - Pointers
- C - Strings
- C - Structures
- C - Unions
- C - Bit Fields
- C - Typedef
- C - Input & Output
- C - File I/O
- C - Preprocessors
- C - Header Files
- C - Type Casting
- C - Error Handling
- C - Recursion
- C - Variable Arguments
- C - Memory Management
- C - Command Line Arguments
- C Programming useful Resources
- C - Questions & Answers
- C - Quick Guide
- C - Useful Resources
- C - Discussion
C program to represent the alphabets in spiral pattern
The spiral pattern to represent the alphabets is as follows −
The logic used to represent the alphabets in spiral model is as follows −
if(rows<=13 && rows>=1){ for(i=1;i<=rows*2;i+=2){ if(k%2==1){ printf("%c %c",i+64,i+65); k++; }else{ printf("%c %c",i+65,i+64); k++; } printf("
"); } } else{ printf("Please Enter from 1 to 13 only
"); }
Program
Following is the C program to represent the alphabets in spiral pattern −
#include<stdio.h> main(){ int i,rows,k=1; printf("Enter number of Rows for Spiral Alpha Pattern from 1 to 13
"); scanf("%d",&rows); if(rows<=13 && rows>=1){ for(i=1;i<=rows*2;i+=2){ if(k%2==1){ printf("%c %c",i+64,i+65); k++; }else{ printf("%c %c",i+65,i+64); k++; } printf("
"); } }else{ printf("Please Enter from 1 to 13 only
"); } }
Output
When the above program is executed, it produces the following result −
Enter number of Rows for Spiral Alpha Pattern from 1 to 13 10 A B D C E F H G I J L K M N P O Q R T S
- Related Articles
- C program to represent the numbers in spiral pattern
- Swift program to print spiral pattern
- Java Program to Print Spiral Pattern of Numbers
- Golang Program to Print Spiral Pattern of Numbers
- Python program to print rangoli pattern using alphabets
- C++ program to generate random alphabets
- Program for triangular patterns of alphabets in C
- Spiral Matrix in C++
- C Program to display the numbers in X pattern
- Program to print Interesting pattern in C++
- Program to print Kite Pattern in C++
- Program to print number pattern in C
- Program to print Diamond Pattern in C
- Program to print numeric pattern in C
- Program to print pyramid pattern in C

Advertisements