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:
- #include <stdio.h>
- #include <stdlib.h>
- int main(int argc, char *argv[])
- {
- int x, y, letter = 65;
- for( y = 10; y >= -10 ; y--)
- {
- for( x = -10; x <= 10; x++)
- {
- 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))
- {
- if(letter == 91)
- letter = 65;
- if((y == -x) || (y == x) || (y==0) || (x==0) || (x==10) || (x==-10) || (y== -10) || (y == 10))
- printf("*");
- else
- {
- printf("%c", letter);
- letter++;
- }
- }
- else
- printf(" ");
- }
- printf("\n");;
- }
- system("PAUSE");
- return 0;
- }
No comments:
Post a Comment