Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /******************************************************************************
- Online C++ Compiler.
- Code, Compile, Run and Debug C++ program online.
- Write your code in this editor and press "Run" button to compile and execute it.
- *******************************************************************************/
- #include <stdio.h>
- int main()
- {
- printf("Enter N: ");
- printf("\n");
- long n;
- scanf("%d", &n);
- for (long i = 1; i <= n; i += 1) {
- for (long j = 0; j < n-i; j += 1) {
- printf(" ");
- }
- if (i == 1 || i == n) {
- for (long j = 0; j < 2*i-1; j += 1) {
- printf("*");
- }
- } else {
- printf("*");
- for (long j = 0; j < (i-1)*2-1; j += 1) {
- printf("#");
- }
- printf("*");
- }
- for (long j = 0; j < n-i; j += 1) {
- printf(" ");
- }
- printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement