Recent Posts

Tuesday 31 July 2018

How to print pattern in C

In the previous post we learn about Program for palindrome number in C and Sum of digits in C and in this post we will learn how to create pyramid, half of pyramid and patterns using *

We can create pyramid, half pyramid and patterns by using loops if, if else.
you need to have the basic knowledge of loops if...else ,while, do while, continue and break.

Program to print patterns and pyramids and half pyramids :

1.Program to print half pyramid print using * :


#include <stdio.h>

#include <conio.h>

int main()

{

    int i, j, r;

   for(i=1; i<=5; i++)

    {

        for(j=1; j<=i; j++)

        {

            printf("* ");

        }

        printf("\n");

    }

    return 0;

}

Output:
*
**
***
****
*****
















0 comments:

Post a Comment

Followers

Popular Posts

Categories

social media

Text Widget

Powered by Blogger.

About Me

My name is junaid khan and i am a full time blogger and author of a blog tutorial called tutorialpointsolution.

String function

In the previous post we learn about what is String .we know that string is a collection of two or more characters.In string we can store al...

Search This Blog

Technology

Adbox

Recent Post

Breaking

Recent In Internet

Comments

Facebook

Pages

Comments

Pages

Recent

Pages

Technology