Skip to main content

Posts

Showing posts from August, 2013

Program to print pattern using * (asterik)

Q1 Write a C program to print pattern as below :-     *    ***  ***** ******* #include<stdio.h> #include<conio.h> void main() { clrscr(); for(int i=0;i<4;i++) { for(int j=3;j>i;j--) { printf(" "); //print a space } for(int k=0;k<2*i+1;k++) { printf("*"); } printf("\n"); } getch(); } Q2 Write a C program to print pattern as below :-       *     * *   * * * * *  *  * #include<stdio.h> #include<conio.h> void main() { clrscr(); for(int i=0;i<4;i++) { for(int j=3;j>i;j--) { printf(" "); //print a space } for(int k=0;k<=i;k++) { printf("*"); } printf("\n"); } getch(); }