

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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("\n"); } } else{ printf("Please Enter from 1 to 13 only\n"); }
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\n"); 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("\n"); } }else{ printf("Please Enter from 1 to 13 only\n"); } }
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 Questions & Answers
- C program to represent the numbers in spiral pattern
- Java Program to Print Spiral Pattern of Numbers
- Python program to print rangoli pattern using alphabets
- C++ program to generate random alphabets
- C Program to represent a multiplication table.
- Spiral Matrix in C++
- C++ Program to Represent Graph Using Incidence List
- C++ Program to Represent Graph Using 2D Arrays
- C++ Program to Represent Graph Using Adjacency Matrix
- C++ Program to Represent Graph Using Incidence Matrix
- C++ Program to Represent Graph Using Adjacency List
- C++ Program to Represent Graph Using Linked List
- C++ Program to Represent Linear Equations in Matrix Form
- C Program to display the numbers in X pattern
- Spiral Matrix III in C++
Advertisements