Search

Pyramid Patterns in C || C Programs

Code -

#include <stdio.h> 
#include <conio.h> 
void main()  
{  
 int i, j, rows;  
    printf (" Enter a number to define the rows: \n ");  
    scanf("%d", &rows);  
    printf("\n");  
 for (i = 1; i <= rows; ++i) // outer loop 
    {  
 for (j = 1; j <= i; ++j) // inner loop 
        {  
            printf ("* "); // print the Star 
        }  
        printf ("\n");   
    }  
    getch();      
}  

Output -


10 views0 comments

Related Posts

See All

Program of Random Number in C || C Programs

Code - #include <stdio.h> #include <conio.h> #include <stdlib.h> void main() { // use rand() function to generate the number printf (" The random number is: %d", rand()); pri

Getchar() function in C || C Programs

Code - #include <stdio.h> #include <conio.h> void main() { char c; printf ("\n Enter a character \n"); c = getchar(); // get a single character printf(" You have passed ")

GCD of two numbers in C || C Programs

Code - #include <stdio.h> #include <conio.h> int main() { // declare the variables int n1, n2, i, GCD_Num; printf ( " Enter any two numbers: \n "); scanf ( "%d %d", &n1, &n2);

  • 1024px-Telegram_logo.svg
  • download
  • YouTube