C programming code to create a pyramid by using alphabets - My CS Tutorial - My CS Tutorial

Breaking

Programming languages full tutorial and programs, exam papers, visual basic( Vb.net ), information of new technologies and more....

Tuesday, December 17, 2019

C programming code to create a pyramid by using alphabets - My CS Tutorial

C programming code or program to print a pyramid by using alphabets and symbols.
In this tutorial we will leran how to write a c programming code that create or print a pyramid pattern by alphabets.In this pyramid pattern we will use alphabets in both forms as upper and lower case letters and symbols that are allowed in c programming language.


C program code



#include<stdio.h>
#include<conio.h>
void main()
{
    int a,b,c,rows,count,temp=1,alpha;
    printf("\n Enter number of rows:\n ");
    scanf("%d",&rows);
    printf("\n");
    count=rows-1;

    for(a=1;a<=rows;a++)
    {
        alpha=65;
        for(b=1;b<=count;b++)
        {
            printf(" ");

        }
        for(c=1;c<=temp;c++)
        {
            printf("%c",alpha);
                alpha++;
        }
        count--;
        temp+=2;

        printf("\n");
    }
    getch();
}


OUTPUT:







In this output we can see that the range or size of pyramid is 25 and the total lines of alphabets and symbols in this pyramid is 25.
we will enter the range(size) of this pyramid and press the enter button then the pyramid will be print on to the screen.This pyramid is a triangle also.


Please share this post and blog link with your friends.For more programs use this blog.
If you have any problem, please comment in comment box, subscribe this blog for notifications of new post on your email and follow this blog.If you have any method of this program or want to give any suggestion send email on hc78326@gmail.com

Created by-- HARSH CHAUHAN

No comments:

Post a Comment