friends Help me i want to print this type of pattern | CTechnotips

Problem : friends Help Me i want to print this type of pattern:

*
..*
....*
......*
........*
..........*
............*
..............*
.................* 

where dot showing the space

Solution :

#include<stdio.h>
#include<conio.h>
void main()
{
    int i=0,no=0,j=0;
    clrscr();
    printf("\nPlease Enter The Number : - ");
    scanf("%d",&no);
    for(i=0;i<no;i++)
    {
        printf("\n");
        for(j=0;j<no;j++)
        {
            if(i==j)
            printf("*");
            else
            printf(" ");
        }
    }
    getch();
}

1 comments:

Anonymous said...

For more information about C practicals, visit

http://cprogrampracticals.blogspot.com

Post a Comment