C program to print pyramid





Write a c program to print pyramid shape.

int main(){
    char *ptr="*********";
    int i,j;
    
    for(i=0;i<5;i++){
       printf("%*.*s\n",5+i,2*i+1,ptr);
    }
    return 0;
}

Output:

    *
   ***
  *****
 *******
*********


No comments: