Monday, 3 September 2012

Program to print Simple Pattern with C coding

Print the following pattern:
                                                            12345
                                                            2345
                                                            345
                                                            45
                                                            5
#include <stdio.h>
#include <conio.h>
void main()
{
    int i,j;
    for(i=1;i<=5;i++)
    {
        for(j=i;j<=5;j++)
        printf("%d",j);
        printf("\n");
        }
        }
                                                          12345
                                                          1234
                                                          123
                                                          12
                                                          1
#include <stdio.h>
#include <conio.h>
void main()
{
    int i,j;
    for(i=5;i>=1;i--)
    {
        for(j=1;j<=i;j++)
        printf("%d",j);
        printf("\n");
        }
      }

No comments:

Post a Comment