Programmator
Programmator
  • Home
  • Download
  • Social
    • YouTube
    • Instagram
    • Facebook
    • Telegram
  • Features
    • C/C++
    • Java
  • Contact Us
Hollow Pyramid Star Pattern

For the pyramid at the first line it will print one star, and at the last line it will print n number of stars. For other lines it will print exactly two stars at the end of the line, and there will be some blank spaces between these two stars.

  •  Program:

#include<stdio.h>

void main()
{
    int a,b,c,d,e;
    printf("Enter the number of rows: ");
    scanf("%d",&a);
    b=a;
    for(c=1;c<=a;c++)
    {
        for(d=1;d<=b-1;d++)
        {
            printf(" ");
        }
        for(e=1;e<=2*c-1;e++)
        {
            if(e==1 || e==2*c-1 || c==a)
            {
                printf("*");
            }
            else
            {
                printf(" ");
            }
        }
        b--;
        printf("\n");
    }
}

  •  Output:

Enter the number of rows: 5 * * * * * * * *********

  •  Star Pattern:

Write a C program to print full diamond star pattern Here
Write a C program to print following A-B-C patterns Here
Write a C program to print following 1-2-3 patterns Here
Write a C Program to print following patterns Here

  •  Visit:

Write a C program to computer Fahrenheit from centigrade ( f=1.8*c+32 ) Here
Write a C program to find out distance travelled by the equation d=ut+at^2 Here
Write a C program to find that the accepted number is negative or positive or zero Here
Write a program to read mark of a student from keyboard the student is pass or fail ( using if else ) Here
Write a program to read three numbers from keyboard and find out maximum out of these three. (nested if else) Here
Write a program to check whether the entered character is capital, small letter, digit or any special character Here
Write a program to read marks from keyboard and your program should display equivalent grade according to following table (if else ladder) Here
Write a C program to prepare pay slip using following data Here
Write a C program to read no 1 to 7 and print relatively day Sunday to Saturday Here
Write a C program to find out the Maximum and Minimum number from given 10 numbers Here
Write a C program to input an integer number and check the last digit of number is even or odd Here 
Write a C program to find factorial of a given number Here
Write a C program to reverse a number Here
Write a C program to generate first n number of Fibonacci series Here
Write a C program to find out sum of first and last digit of a given number Here
Write a C program to find the sum and average of different numbers Here
Write a program to calculate average and total of 5 students for 3 subjects Here
Read five persons height and weight and count the number of person having height greater than 170 and weight less than 50 Here
Write a program to check whether the given number is prime or not Here
Write a program to evaluate the series 1^2+2^2+2+3^2+……+n^2 Here
Write a C program to find 1+1/2+1/3+1/4+....+1/n Here
Write a C program to find 1+1/2!+1/3!+1/4!+.....+1/n! Here
Write a C program to evaluate the series sum=1-x+x^2/2!-x^3/3!+x^4/4!......-x^9/9! Here
Write a C program to read and store the roll no and marks of 20 students using array Here
Write a C program to find out which number is even or odd from list of 10 number using array Here
Write a program to find maximum element from 1-Dimensional array Here
Write a C program to calculate the average, geometric and harmonic mean of n elements in a array Here
Write a program to delete a character in given string Here
Write a program to replace a character in given string Here
Write a program to find a character from given string Here
Write a program to sort given array in ascending order Here
Write a program to reverse string Here
Write a program to convert string into upper case Here
Write a program that defines a function to add first n numbers Here
Write a function in the program to return 1 if number is prime otherwise return 0 Here
Write a function Exchange to interchange the values of two variables, say x and y. illustrate the use of this function in a calling function Here
Write a C program to use recursive calls to evaluate F(x) = x – x3 / 3! + x5 / 5 ! – x7 / 7! + … xn/ n! Here
Write a program to find factorial of a number using recursion Here
Write a function that will scan a character string passed as an argument and convert all lowercase character into their uppercase equivalents Here
Write a program to read structure elements from keyboard Here
Full Diamond Star Pattern In C Programming Language 

For printing the star full diamond pattern, the number of line is taken as input. The pattern is divided into two part. In the first half, the number of the stars are increased and in the 2nd part, the number of stars are decreased. Two extra variables are taken here  to count the number of stars and the number of spaces for each line. for printing the number of line as input checking is done. If it is odd, then only the pattern can be printed else an error message is shown.

  •  Program:

#include<stdio.h>

int main()
{
    int a,b,c=1,d,e,f;

    printf("Enter the number of lines :");
    scanf("%d",&a);

    b=a/2+1;
    //printing this pattern is possible if the number of lines is odd
    if(a%2!=0)
    {
        //printing the first half of the pattern where the number of stars
//are increasing
        for(d=1;d<=a/2+1;d++)
        {
            for(e=1;e<=b;e++)
            {
                printf(" ");
            }
            for(f=1;f<=c;f++)
            {
                printf("*");
            }
            printf("\n");
            b--;
            c+=2;
        }
        //printing the second half of the pattern where the number of stars
//are decreasing
        b=b+2;
        c=c-4;
        for(d=a/2+2;d<=a;d++)
        {
            for(e=1;e<=b;e++)
            {
                printf(" ");
            }
            for(f=1;f<=c;f++)
            {
                printf("*");
            }
            printf("\n");
            b++;
            c-=2;
        }
    }
    //printing the error message if number of line is even
    else
    {
        printf("\nPlease give correct input(no. of line should be odd)");
    }
}

  •  Output:

Enter the number of lines :11 * *** ***** ******* ********* *********** ********* ******* ***** *** *

Or.

Enter the number of lines :10 Please give correct input(no. of line should be odd)
 
  •  Star Pattern:

Write a c program to print following A-B-C patterns Here
Write a C program to print following 1-2-3 patterns Here

  •  Visit:

Write a C program to computer Fahrenheit from centigrade ( f=1.8*c+32 ) Here
Write a C program to find out distance travelled by the equation d=ut+at^2 Here
Write a C program to find that the accepted number is negative or positive or zero Here
Write a program to read mark of a student from keyboard the student is pass or fail ( using if else ) Here
Write a program to read three numbers from keyboard and find out maximum out of these three. (nested if else) Here
Write a program to check whether the entered character is capital, small letter, digit or any special character Here
Write a program to read marks from keyboard and your program should display equivalent grade according to following table (if else ladder) Here
Write a C program to prepare pay slip using following data Here
Write a C program to read no 1 to 7 and print relatively day Sunday to Saturday Here
Write a C program to find out the Maximum and Minimum number from given 10 numbers Here
Write a C program to input an integer number and check the last digit of number is even or odd Here 
Write a C program to find factorial of a given number Here
Write a C program to reverse a number Here
Write a C program to generate first n number of Fibonacci series Here
Write a C program to find out sum of first and last digit of a given number Here
Write a C program to find the sum and average of different numbers Here
Write a program to calculate average and total of 5 students for 3 subjects Here
Read five persons height and weight and count the number of person having height greater than 170 and weight less than 50 Here
Write a program to check whether the given number is prime or not Here
Write a program to evaluate the series 1^2+2^2+2+3^2+……+n^2 Here
Write a C program to find 1+1/2+1/3+1/4+....+1/n Here
Write a C program to find 1+1/2!+1/3!+1/4!+.....+1/n! Here
Write a C program to evaluate the series sum=1-x+x^2/2!-x^3/3!+x^4/4!......-x^9/9! Here
Write a C program to read and store the roll no and marks of 20 students using array Here
Write a C program to find out which number is even or odd from list of 10 number using array Here
Write a program to find maximum element from 1-Dimensional array Here
Write a C program to calculate the average, geometric and harmonic mean of n elements in a array Here
Write a program to delete a character in given string Here
Write a program to replace a character in given string Here
Write a program to find a character from given string Here
Write a program to sort given array in ascending order Here
Write a program to reverse string Here
Write a program to convert string into upper case Here
Write a program that defines a function to add first n numbers Here
Write a function in the program to return 1 if number is prime otherwise return 0 Here
Write a function Exchange to interchange the values of two variables, say x and y. illustrate the use of this function in a calling function Here
Write a C program to use recursive calls to evaluate F(x) = x – x3 / 3! + x5 / 5 ! – x7 / 7! + … xn/ n! Here
Write a program to find factorial of a number using recursion Here
Write a function that will scan a character string passed as an argument and convert all lowercase character into their uppercase equivalents Here
Write a program to read structure elements from keyboard Here
1-2-3 patterns

I)    
        1
        12
        123
        1234
        12345
       
  •  Program:

#include<stdio.h>
#include<conio.h>

int main()
{
    int a,b,c;

    printf("Enter the number: ");
    scanf("%d",&c);

    for(a=1;a<=c;a++)
    {
        for(b=1;b<=a;b++)
        {
            printf("%d",b);
        }
        printf("\n");
    }
    return 0;
}

  •  Output:
Enter the number: 5
1
12
123
1234
12345


II)
        12345
        1234
        123
        12
        1

  •  Program:

#include<stdio.h>
#include<conio.h>

int main()
{
    int a,b,c;

    printf("Enter the number: ");
    scanf("%d",&c);

    for(a=c;a>=1;a--)
    {
        for(b=1;b<=a;b++)
        {
            printf("%d",b);
        }
        printf("\n");
    }
    return 0;
}

  •  Output:

Enter the number: 5 12345 1234 123 12 1

III)
        1
        22
        333
        4444
        55555
        666666

  •  Program:

#include<stdio.h>
//here we have not used conio.h bcz in this code one status will return the value.

int main()
{
    int a, b, c;

    printf("Enter the number: ");
    scanf("%d",&c);

    for(a=1;a<=c;a++)
    {
        for(b=1;b<=a;b++)
        {
            printf("%d",a);
        }
        printf("\n");
    }
    return 0;
}

  •  Output:

Enter the number: 6 1 22 333 4444 55555 666666

IV)
        666666
        55555
        4444
        333
        22
        1

  •  Program:

#include<stdio.h>
//here we have not used conio.h bcz in this code one status will return the value.

int main()
{
    int a, b, c;

    printf("Enter the number: ");
    scanf("%d",&c);

    for(a=c;a>=1;a--)
    {
        for(b=1;b<=a;b++)
        {
            printf("%d",a);
        }
        printf("\n");
    }
    return 0;
}

  •  Output:

Enter the number: 6 666666 55555 4444 333 22 1
 
  •  Star Pattern:

Write a C program to print full diamond star pattern Here
Write a c program to print following A-B-C patterns Here

  •  Visit:

Write a C program to computer Fahrenheit from centigrade ( f=1.8*c+32 ) Here
Write a C program to find out distance travelled by the equation d=ut+at^2 Here
Write a C program to find that the accepted number is negative or positive or zero Here
Write a program to read mark of a student from keyboard the student is pass or fail ( using if else ) Here
Write a program to read three numbers from keyboard and find out maximum out of these three. (nested if else) Here
Write a program to check whether the entered character is capital, small letter, digit or any special character Here
Write a program to read marks from keyboard and your program should display equivalent grade according to following table (if else ladder) Here
Write a C program to prepare pay slip using following data Here
Write a C program to read no 1 to 7 and print relatively day Sunday to Saturday Here
Write a C program to find out the Maximum and Minimum number from given 10 numbers Here
Write a C program to input an integer number and check the last digit of number is even or odd Here 
Write a C program to find factorial of a given number Here
Write a C program to reverse a number Here
Write a C program to generate first n number of Fibonacci series Here
Write a C program to find out sum of first and last digit of a given number Here
Write a C program to find the sum and average of different numbers Here
Write a program to calculate average and total of 5 students for 3 subjects Here
Read five persons height and weight and count the number of person having height greater than 170 and weight less than 50 Here
Write a program to check whether the given number is prime or not Here
Write a program to evaluate the series 1^2+2^2+2+3^2+……+n^2 Here
Write a C program to find 1+1/2+1/3+1/4+....+1/n Here
Write a C program to find 1+1/2!+1/3!+1/4!+.....+1/n! Here
Write a C program to evaluate the series sum=1-x+x^2/2!-x^3/3!+x^4/4!......-x^9/9! Here
Write a C program to read and store the roll no and marks of 20 students using array Here
Write a C program to find out which number is even or odd from list of 10 number using array Here
Write a program to find maximum element from 1-Dimensional array Here
Write a C program to calculate the average, geometric and harmonic mean of n elements in a array Here
Write a program to delete a character in given string Here
Write a program to replace a character in given string Here
Write a program to find a character from given string Here
Write a program to sort given array in ascending order Here
Write a program to reverse string Here
Write a program to convert string into upper case Here
Write a program that defines a function to add first n numbers Here
Write a function in the program to return 1 if number is prime otherwise return 0 Here
Write a function Exchange to interchange the values of two variables, say x and y. illustrate the use of this function in a calling function Here
Write a C program to use recursive calls to evaluate F(x) = x – x3 / 3! + x5 / 5 ! – x7 / 7! + … xn/ n! Here
Write a program to find factorial of a number using recursion Here
Write a function that will scan a character string passed as an argument and convert all lowercase character into their uppercase equivalents Here
Write a program to read structure elements from keyboard Here
 I. C-program for character/alphabet pattern 4

       AAAAA
       BBBB
       CCC
       DD
       E


  • Program:

#include<stdio.h>
#include<conio.h>

void main()
{
  int a,b,c;

  printf("Enter the no of lines :");
  scanf("%d",&c);

  for(a=1;a<=c;a++)
  {
    for(b=a;b<=c;b++)
    {
      printf("%c",(char)(a+64));
    }
    printf("\n");
  }
}

  •  Output:

Enter the no of lines :5 AAAAA BBBB CCC DD E


II. C-program for character/alphabet pattern 6

        ABCDE
        ABCD
        ABC
        AB
        A    

  •  Program:

#include<stdio.h>
#include<conio.h>

void main()
{
  int a,b,c;

  printf("Enter the no of line :");
  scanf("%d",&c);

  for(a=1;a<=c;a++)
  {
    for(b=1;b<=c-a+1;b++)
    {
      printf("%c",(char)(b+64));
    }
    printf("\n");
  }
}

  •  Output:

Enter the no of line :5 ABCDE ABCD ABC AB A

  •  Star Pattern:

Write a C program to print full diamond star pattern Here
Write a C program to print following 1-2-3 patterns Here

  •  Visit:

Write a C program to computer Fahrenheit from centigrade ( f=1.8*c+32 ) Here
Write a C program to find out distance travelled by the equation d=ut+at^2 Here
Write a C program to find that the accepted number is negative or positive or zero Here
Write a program to read mark of a student from keyboard the student is pass or fail ( using if else ) Here
Write a program to read three numbers from keyboard and find out maximum out of these three. (nested if else) Here
Write a program to check whether the entered character is capital, small letter, digit or any special character Here
Write a program to read marks from keyboard and your program should display equivalent grade according to following table (if else ladder) Here
Write a C program to prepare pay slip using following data Here
Write a C program to read no 1 to 7 and print relatively day Sunday to Saturday Here
Write a C program to find out the Maximum and Minimum number from given 10 numbers Here
Write a C program to input an integer number and check the last digit of number is even or odd Here 
Write a C program to find factorial of a given number Here
Write a C program to reverse a number Here
Write a C program to generate first n number of Fibonacci series Here
Write a C program to find out sum of first and last digit of a given number Here
Write a C program to find the sum and average of different numbers Here
Write a program to calculate average and total of 5 students for 3 subjects Here
Read five persons height and weight and count the number of person having height greater than 170 and weight less than 50 Here
Write a program to check whether the given number is prime or not Here
Write a program to evaluate the series 1^2+2^2+2+3^2+……+n^2 Here
Write a C program to find 1+1/2+1/3+1/4+....+1/n Here
Write a C program to find 1+1/2!+1/3!+1/4!+.....+1/n! Here
Write a C program to evaluate the series sum=1-x+x^2/2!-x^3/3!+x^4/4!......-x^9/9! Here
Write a C program to read and store the roll no and marks of 20 students using array Here
Write a C program to find out which number is even or odd from list of 10 number using array Here
Write a program to find maximum element from 1-Dimensional array Here
Write a C program to calculate the average, geometric and harmonic mean of n elements in a array Here
Write a program to delete a character in given string Here
Write a program to replace a character in given string Here
Write a program to find a character from given string Here
Write a program to sort given array in ascending order Here
Write a program to reverse string Here
Write a program to convert string into upper case Here
Write a program that defines a function to add first n numbers Here
Write a function in the program to return 1 if number is prime otherwise return 0 Here
Write a function Exchange to interchange the values of two variables, say x and y. illustrate the use of this function in a calling function Here
Write a C program to use recursive calls to evaluate F(x) = x – x3 / 3! + x5 / 5 ! – x7 / 7! + … xn/ n! Here
Write a program to find factorial of a number using recursion Here
Write a function that will scan a character string passed as an argument and convert all lowercase character into their uppercase equivalents Here
Write a program to read structure elements from keyboard Here
Write a c program to print following patterns
Star pattern program in c
Pattern programs in c
Pattern in c programming

(i)   Right triangle star pattern

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

  • Program:

#include<stdio.h> #include<conio.h> int main() { int i,j; for(i=1; i<=4; i++) { for(j=1; j<=i; j++) { printf("*"); } printf(" \n");
} }




(ii)   Inverted mirrored right triangle star pattern

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

  • Program:

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

(iii)   Mirrored right triangle star pattern 
 
                   *
                * *
             * * *
           * * * *
        * * * * *

  • Program:

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




(iv)   Inverted right triangle star pattern

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

  • Program:

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

  •  Visit:

Write a C program to computer Fahrenheit from centigrade ( f=1.8*c+32 ) Here
Write a C program to find out distance travelled by the equation d=ut+at^2 Here
Write a C program to find that the accepted number is negative or positive or zero Here
Write a program to read mark of a student from keyboard the student is pass or fail ( using if else ) Here
Write a program to read three numbers from keyboard and find out maximum out of these three. (nested if else) Here
Write a program to check whether the entered character is capital, small letter, digit or any special character Here
Write a program to read marks from keyboard and your program should display equivalent grade according to following table (if else ladder) Here
Write a C program to prepare pay slip using following data Here
Write a C program to read no 1 to 7 and print relatively day Sunday to Saturday Here
Write a C program to find out the Maximum and Minimum number from given 10 numbers Here
Write a C program to input an integer number and check the last digit of number is even or odd Here 
Write a C program to find factorial of a given number Here
Write a C program to reverse a number Here
Write a C program to generate first n number of Fibonacci series Here
Write a C program to find out sum of first and last digit of a given number Here
Write a C program to find the sum and average of different numbers Here
Write a program to calculate average and total of 5 students for 3 subjects Here
Read five persons height and weight and count the number of person having height greater than 170 and weight less than 50 Here
Write a program to check whether the given number is prime or not Here
Write a program to evaluate the series 1^2+2^2+2+3^2+……+n^2 Here
Write a C program to find 1+1/2+1/3+1/4+....+1/n Here
Write a C program to find 1+1/2!+1/3!+1/4!+.....+1/n! Here
Write a C program to evaluate the series sum=1-x+x^2/2!-x^3/3!+x^4/4!......-x^9/9! Here
Write a C program to read and store the roll no and marks of 20 students using array Here
Write a C program to find out which number is even or odd from list of 10 number using array Here
Write a program to find maximum element from 1-Dimensional array Here
Write a C program to calculate the average, geometric and harmonic mean of n elements in a array Here
Write a program to delete a character in given string Here
Write a program to replace a character in given string Here
Write a program to find a character from given string Here
Write a program to sort given array in ascending order Here
Write a program to reverse string Here
Write a program to convert string into upper case Here
Write a program that defines a function to add first n numbers Here
Write a function in the program to return 1 if number is prime otherwise return 0 Here
Write a function Exchange to interchange the values of two variables, say x and y. illustrate the use of this function in a calling function Here
Write a C program to use recursive calls to evaluate F(x) = x – x3 / 3! + x5 / 5 ! – x7 / 7! + … xn/ n! Here
Write a program to find factorial of a number using recursion Here
Write a function that will scan a character string passed as an argument and convert all lowercase character into their uppercase equivalents Here
Write a program to read structure elements from keyboard Here
Newer Posts Older Posts Home

ABOUT

I could look back at my life and get a good story out of it. It's a picture of somebody trying to figure things out.

SUBSCRIBE & FOLLOW

POPULAR POSTS

  • Write a C program to enter a distance in to kilometer and convert it in to meter, feet, inches and centimeter
  • Write a C program to computer Fahrenheit from centigrade ( f=1.8*c+32 )
  • Write a C program to interchange two numbers
  • Write a C program to read and store the roll no and marks of 20 students using array
  • Write a C program to evaluate the series sum=1-x+x^2/2!-x^3/3!+x^4/4!......-x^9/9!

Advertisement

👆 Shopping 👆

Powered by Blogger

Archive

  • February 20241
  • January 20242
  • November 20234
  • October 20236
  • September 20236
  • August 20235
  • April 20231
  • March 20231
  • October 20221
  • August 20223
  • July 20222
  • May 20223
  • April 20222
  • March 20221
  • January 20221
  • December 20216
  • November 20214
  • October 20211
  • September 20216
  • August 202127
  • July 20216

Report Abuse

Copyright

  • Home
  • About us
  • Privacy Policy
  • Disclaimer
  • Contact Us

About Me

Nilesh Patel
View my complete profile

Copyright © Programmator. Designed by OddThemes