Author Topic: Turbo C Program to Rotating Number Pattern 1 - 25  (Read 1184 times)

kathir

  • Administrator
  • Sr. Member
  • *****
  • Posts: 283
Turbo C Program to Rotating Number Pattern 1 - 25
« on: March 08, 2012, 12:22:11 pm »
Here is the Turbo C Program for Rotating Number Pattern 1 - 25


Code:
//Source Code Listing


#include <stdio.h>
#include <conio.h>


void main()
{
   int i = 1;
   int x = 10;
   int y = 10;

   for(i = 1; i <= 25; i++)
   {
      if(i <= 5)
         x += 3;
      else if(i <= 9)
         y += 1;
      else if(i <= 13)
         x -= 3;
      else if(i <= 16)
         y--;
      else if(i <= 19)
         x += 3;
      else if(i <= 21)
         y += 1;
      else if(i <= 23)
         x -= 3;
      else if(i <= 24)
         y--;
      else if(i <= 25)
         x += 3;
      gotoxy(x, y);
      printf("%-2d", i);
   }

   gotoxy(x, y + 5);
   return;
}


 


Disclaimer: This web site is for educational and informational purposes only. Click here to read the Disclaimer.
Content copyright 2010-2014. Kathiresan. All rights reserved.
This page is using SMF version 2.0.1