ad

Tuesday, April 15, 2025

C program to Print A star pattern Asterisks pattern

 C Program

C program to Print A star pattern Asterisks pattern


C program to Print A star pattern Asterisks pattern 

Example:-


#include <stdio.h>
int main() {
    int no = 7;
    int i, j;
    for (i = 0; i < no; i++)

{
        for (j = 0; j <= no; j++)

{
              if ((j == 0 || j == no) && i != 0 || (i == 0 && j > 0 && j < no) ||
(i == no / 2))


                printf("*");
            else
                printf(" ");
        }
        printf("\n");
    }

    getch();


    return 0;
    }





C program to Print A star pattern Asterisks pattern 

Output :-

C program to Print A star pattern Asterisks pattern


Monday, April 14, 2025

C Program to print Hollow Hourglass pattern

   C  Program


C Program to print Hollow Hourglass pattern

C Program to print Hollow Hourglass pattern 

Example :-

#include <stdio.h>
 
int main()
{
  int i, j, k, rows;
 
  printf("Enter the no. of rows: ");
  scanf("%d", &rows);
 
  printf("Output: \n\n");
 
  for (i = 1; i <= rows; i++)
  {
    for (k = 1; k < i; k++)
      printf(" ");
 
    for (j = i; j <= rows; j++)
      printf("* ");
 
    printf("\n");
  }
 
  for (i = rows - 1; i >= 1; i--)
  {
    for (k = 1; k < i; k++)
      printf(" ");
 
    for (j = i; j <= rows; j++)
      printf("* ");
 
    printf("\n");
  }
 
  return 0;
}


C Program to print Hollow Hourglass pattern 

Output :-


C Program to print Hollow Hourglass pattern



Related Post :- 

C program to print full pyramid of star

C program to print inverted half


C Program to print Hollow Diamond Star Pattern

C Program

C Program to print Hollow Diamond Star Pattern

C Program to print Hollow Diamond Star Pattern

Example :-

#include <stdio.h>
#include <stdlib.h>
int main()
{
int i,j,rows;
printf("Enter the number \n");
scanf("%d",&rows);


for(i=1; i<=rows; i++){
for(j=rows; j>i; j--){
printf(" ");
}


printf("*");
for(j=1; j<(i-1)*2; j++){
printf(" ");
}


if(i==1){
printf("\n");
}


else{
printf("*\n");
}
}

for(i=rows-1; i>=1; i--){
for(j=rows; j>i; j--){
printf(" ");
}


printf("*");
for(j=1; j<(i-1)*2; j++){
printf(" ");
}


if(i==1){
printf("\n");
}


else{
printf("*\n");
}
}
return 0;
}


C Program to print Hollow Diamond Star Pattern

Output:-

C Program to print Hollow Diamond Star Pattern


Related Post :- 


c program to print full pyramid of star

C program to print inverted half

Sunday, April 13, 2025

C Program to print Hollow Full pyramid star Pattern

 

C Program to print Hollow Full pyramid star Pattern

C Program to print Hollow Full pyramid star Pattern

C Program to print Hollow Full pyramid star Pattern

Example :-


#include<stdio.h>
int main()

{
int i, space, row, star=0;


printf("Enter The Number ");
scanf("%d",&row);


for(i = 0; i < row-1; i++) {
for(space = 1; space < row-i; space++) {
printf(" ");
}


for (star = 0; star <= 2*i; star++) {
if(star==0 || star==2*i)


printf("*");
else
printf(" ");
}
printf("\n");
}


for(i=0; i<2*row-1; i++){
printf("*");


}
return 0;
}


C Program to print Hollow Full pyramid star Pattern

Output :-

C Program to print Hollow Full pyramid star Pattern


Related Post :-


c program to print floyds triangle

c program to print pascals triangle


C Program to Print Hollow Square Star Pattern


C Program 


C Program to Print Hollow Square  Star Pattern

Q. C Program to Print Hollow Square  Star Pattern 

Example



#include <stdio.h>

int main()
{
   int i, j, N;

 
   printf("Enter number of rows: ");
   scanf("%d", &N);

   for(i=1; i<=N; i++)
   {
   
       for(j=1; j<=N; j++)
       {
           if(i==1 || i==N || j==1 || j==N)
           {
             
               printf("*");
           }
           else
           {
               printf(" ");
           }
       }

     
       printf("\n");
   }

   return 0;
}


Q. C Program to Print Hollow Square  Star Pattern

OutPut :-

C Program to Print Hollow Square  Star Pattern

Related Post :-

c program to print hourglass pattern

c program to print diamond pattern

c program to print rhombus star pattern


Friday, April 11, 2025

C Program to print Hourglass Pattern

  C Program

C Program to print Hourglass Pattern


C Program to print Hourglass Pattern

Example

#include <stdio.h>
 
int main()
{
  int i, j, k, rows;
 
  printf("Enter the no. of rows: ");
  scanf("%d", &rows);
 
  printf("Output: \n\n");
 
  for (i = 1; i <= rows; i++)
  {
    for (k = 1; k < i; k++)
      printf(" ");
 
    for (j = i; j <= rows; j++)
      printf("* ");
 
    printf("\n");
  }
 
  for (i = rows - 1; i >= 1; i--)
  {
    for (k = 1; k < i; k++)
      printf(" ");
 
    for (j = i; j <= rows; j++)
      printf("* ");
 
    printf("\n");
  }
 
  return 0;
}

C Program to print Hourglass Pattern

Output 

C Program to print Hourglass Pattern


Related Post :-

C program to print pascals triangle

C program to print inverted half

Print Inverted Half Pyramid of Stars Pattern

C Program to print Diamond Pattern


C Program  

C Program to print Diamond Pattern



C Program to print Diamond Pattern 

Example:

#include <stdio.h>
int main()
{
  int n,a, k;

  printf("Enter number of rows\n");
  scanf("%d", &n);

  for (k = 1; k <= n; k++)
  {
    for (a = 1; a <= n-k; a++)
      printf(" ");

    for (a = 1; a <= 2*k-1; a++)
      printf("*");

    printf("\n");
  }

  for (k = 1; k <= n - 1; k++)
  {
    for (a = 1; a <= k; a++)
      printf(" ");

    for (a = 1 ; a <= 2*(n-k)-1; a++)
      printf("*");

    printf("\n");
  }

  return 0;
}

C Program to print Diamond Pattern 

Output:


C Program to print Diamond Pattern

Related Post :-

c program to print Rhombus star pattern

c program to print floyds triangle

c program to print pascals triangle

Thursday, April 10, 2025

C Program To Print Rhombus Star Pattern

                                      c Program

C Program To Print Rhombus  Star Pattern

C Program To Print Rhombus  Star Pattern

Example 

#include <stdio.h>

int main()
{
    int i, j, rows;

 
    printf("Enter rows: ");
    scanf("%d", &rows);

    for(i=1; i<=rows; i++)
    {
   
        for(j=1; j<=rows - i; j++)
        {
            printf(" ");
        }

       
        for(j=1; j<=rows; j++)
        {
            printf("*");
        }

       
        printf("\n");
    }

    return 0;
}

C Program To Print Rhombus  Star Pattern

 Program Output :- 

C Program To Print Rhombus  Star Pattern




C Program To Print Floyd's Triangle Pattern

C Program To Print Floyd's Triangle Pattern

C Program To Print Floyd's Triangle Pattern

Example 

#include<stdio.h>
int main()
{

int row,i,j,number=1;
clrscr();
printf("enter the number");
scanf("%D",&row);
for(i=1;i<=row;i++)
{
for(j=1;j<=i;j++)
{
printf("%d",number);
++number;
}
printf("\n");
}
getch();
return 0;
}

C Program To Print Floyd's Triangle Pattern

 Program Output :- 

c program print floyd program


Related Post :-

c program to print full pyramid star

c program to print pascals triangle

c program to print inverted half