Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<conio.h>
- void descending(int height);
- void ascending(int height);
- void eks(int alt);
- void newline(int num);
- void main()
- {
- int number;
- printf("\n\nEnter a number(desired height for figure):");
- scanf_s("%d", &number);
- descending(number);
- newline(2);
- ascending(number);
- newline(2);
- eks(number);
- newline(2);
- _getch();
- }
- void descending(int height)
- {
- for (height; height; height--)
- {
- for (int i = height; i;i--) printf("*");
- printf("\n");
- }
- }
- void ascending(int height)
- {
- int row = 1, i;
- for (row; row <= height; row++)
- {
- for (i = height - row; i; i--) printf(" ");
- for (i = row; i;i--)printf("*");
- printf("\n");
- }
- }
- void eks(int alt)
- {
- int row = 1;
- for (int height = alt; height; height--)
- {
- for (int width = 1; width <= alt; width++)
- {
- if ((width == row) || (width == height)) printf("*");
- else printf(" ");
- }
- printf("\n");
- row++;
- }
- }
- void newline(int num)
- {
- for (num; num; num--)
- printf("\n");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement