Showing posts with label pattern. Show all posts
Showing posts with label pattern. Show all posts

Tuesday, October 4, 2011

Pattern 1



Write a program to print the following pattern:
(1,1)  (1,2)  (1,3)
(3,1)  (3,2)  (3,3)
(5,1)  (5,2)  (5,3)

Program:

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
clrscr();
for(i=1;i<6;i++)
{
for(j=1;j<4;j++)
{
if(i==2 || i==4)
continue;
printf("(%d,%d)\t",i,j);
}
printf("\n");
}
getch();
}


Output:

 
Read full history - Pattern 1

About Me