Contact Learn C
Copy Program Share Program

Program 309: Spiral Pattern in C

Program 309: Spiral Pattern in C
 
#include<stdio.h>
main()
{
 int i,rows,k=1;
 printf("Enter number of Rows for Spiral Pattern\n");
 scanf("%d",&rows);
 for(i=1;i<=rows*2;i+=2)
 {
  if(k%2==1)
  {
   printf("%3d %3d",i,i+1);
   k++;
  }
  else
  {
   printf("%3d %3d",i+1,i);
   k++;
  }
  printf("\n");
 }
}
Spiral Alphabet Pattern 
Explanation:
Spiral Pattern in C Explanation

//Coming Soon...

Output:
Spiral Pattern in C


Download App and Learn when ever you want

Get it on PlayStore
Get it on Amazon App Store
Get it on Aptoide