FY_BCA_C_SLIP_8




//Slip 8_1 Pattern

#include<stdio.h>
main()
{

                int n,c,k,space,count=1;
                printf("Enter number of rows");
                scanf("%d",&n);
                space=n;
                for(c=1;c<=n;c++)
                {
                                for(k=1;k<space;k++)
                                {
                                                printf(" ");
                                }
                                for(k=1;k<=2*c-1;k++)
                                {
                                                if(k%2!=0)
                                                printf("*");
                                                else
                                                printf(" ");
                                }
                                printf("\n");
                                space --;
                }
               
}

No comments:

Post a Comment