Monday, February 15, 2016

C program to print pattern-b

/*=================================================================================
**
**  File Name     : printPattern_b.c
**  Creation Date : Wed 10 Feb 2016 08:04:44 PM IST
**  Last Modified : Mon 15 Feb 2016 04:32:19 AM IST
**  Compoler      : gcc
**  Author        : Manoj Kumar Patra, manojpatra.in@gmail.com
**  Organization  : SCIS, University of Hyderabad, India.
**
**===============================================================================*/

#include<stdio.h>
int main()
{
    printf("\n= = = = = = = = = = Print Pattern = = = = = = = = = =\n");
    int n, i, j, count, item=1;
    printf("\nEnter the value of 'n' : ");
    scanf("%d",&n);
    count=n;
    j=n;
    printf("\n");
    for(i=0; i<j; i++)
    {
        while(count!=0)
        {
            printf("%d\t",item);
            count--;
        }
        printf("\n\n");
        n=n-1;
        count=n;
        item++;
    }
    printf("= = = = = = = = = = = = = = = = = = = = = = = = = = =\n");
    printf("\n");
}

Output:

= = = = = = = = = = Print Pattern = = = = = = = = = =

Enter the value of 'n' : 5

1    1    1    1    1   

2    2    2    2   

3    3    3   

4    4   

5   

= = = = = = = = = = = = = = = = = = = = = = = = = = =

No comments:

Post a Comment