Thursday, 22 January 2015

Program to print a Pattern

//Program to print the following Pattern.

    1
   121
  12321
 1234321
123454321

#include<iostream.h>
#include<conio.h>
void main()
{
 int i,j,k,l;
 clrscr();
  for(i=1;i<=5;i++)
    {
      for(k=1;k<=5-i;k++)
{
cout<<" ";
}
      for(j=1;j<=i;j++)
       {
cout<<j;
       }
       for(l=i-1;l>=1;l--)
       {
cout<<l;
       }
      cout<<"\n";
    }
 getch();
}

No comments:

Post a Comment

Read contacts in iOS using Swift with error handling

Just copy and paste the below code Pre-step before pasting the below code Add below line in AppDelegate.swift file below import statement ...