Write a C Program to Print Star | CodeTextPro - CodeTextPro | Web Tutorial | Technology

CodeTextPro.com Provides - Web design, Technology gyan, Digital marketing, Online earnings, Seo, Adsense, Technology news, Motivation and inspiration, Latest Technology Affairs, Gadgets, Blogging

Saturday, January 5, 2019

Write a C Program to Print Star | CodeTextPro

Star Print in C


In this program, you will learn how to print star in a c program.


C Program to Print Star:

#include<stdio.h>
main()
{
int n,i,j,k;
printf("Enter a number");
scanf("%d",&n);
for(i=1;i<=n;i++)
    {
    for(j=1;j<=n-i;j++)
    {
        printf("");
    }
    for(k=1;k<=i;k++)
    {
        printf("*");
    }
    printf("\n");
    }
    for(i=n-1;i>=1;i--)
    {
    for(j=1;j<=n-i;j++)
    {
    printf("");
    }
    for(k=1;k<=i;k++)
    {
    printf("*");
    }
    printf("\n");
    }
}










No comments:

Post a Comment