Monday, 6 September 2021

How to print the full Pyramid of Star....Using c program..

 #include <stdio.h>

#include <conio.h>  
void main()  
{  
      
    int i, j, rows, k = 0;  
    printf (" Enter a number to define the rows: \n");  
    scanf ("%d", &rows);   
      
    for ( i =1; i <= rows; i++)  
    {  
        for ( j = 1; j <= rows - i; j++)  
        {  
            printf ("  ");   
        }  
         
        for ( k = 1; k <= ( 2 * i - 1); k++)  
        {  
            printf ("* ");  
        }  
        printf ("\n");  
    }  
    getch();  
}


Youtube Video



No comments:

Post a Comment

Program to check whether the reverse string is a palindrome

  # include < stdio.h > # include < string.h > int main ( ) { //declare variables char str1 [ 30 ] ; int i , len...