Answer to Question #308235 in C for ahmed

Question #308235

Write a program to display half pyramid using stars pattern. * * * * * * * * * * * * * * *


1
Expert's answer
2022-03-17T09:37:44-0400
#include <stdio.h>

int main()
{   
    int i, j, n;
    printf("Enter number (n): ");
    scanf("%d", &n);
       printf("\nHalf pyramid:\n\n");
    for (i = 0; i < n; i++)
    {
           for (j = 0; j < i + 1; j++)
            printf("* ");
        printf("\n");
    }
    getchar();
 
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS