Wednesday, December 19, 2012

Windmill Alphabets in Turbo C Program Case Study



Sample Program from Turbo C that can help for IT students in their case Studies.

Download Turbo C for XP Here:
Download Turbo C for Windows 7 / Windows 8 Here:



  1. #include <stdio.h>
  2. #include <stdlib.h>

  3. int main(int argc, char *argv[])
  4. {

  5. int x, y, letter = 65;
  6. for( y = 10; y >= -10 ; y--)
  7. {

  8. for( x = -10; x <= 10; x++)
  9. {
  10. if( ( y >= x && x > 0 && y > 0) ||(y <= x && x < 0 && y < 0) || (y >= -x && x > 0 && y < 0) || (y <= -x && x < 0 && y > 0)  || (x == 0) || (y == 0))                            
  11. {
  12.                 if(letter == 91)
  13.                           letter = 65;
  14.                 
  15.                 if((y == -x) || (y == x) || (y==0) || (x==0) || (x==10) || (x==-10) || (y== -10) || (y == 10))
  16.                       printf("*");
  17.                 else
  18.                 {
  19.                     printf("%c", letter);
  20.                     letter++;
  21.                 }
  22.                 }
  23.             else
  24. printf(" ");
  25. }
  26. printf("\n");;
  27. }



  28.   system("PAUSE");
  29.   return 0;
  30. }

No comments:

Post a Comment