-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAssignment16_5.c
46 lines (43 loc) · 914 Bytes
/
Assignment16_5.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include<stdio.h>
void Pattern(int iRow, int iCol)
{
int i=0,j=0;
if(iRow!=iCol)
{
printf("number rows and column should same\n");
return;
}
for(i=1;i<=iRow;i++)
{
printf("\n");
for(j=1;j<=iCol;j++)
{
if((i==j)||(i==iRow)||(j==iCol)||(i==1)||(j==1))
{
printf("%d\t",j);
}
else
{
printf("\t");
}
}
}
printf("\n");
}
int main()
{
int iValue1 = 0, iValue2 = 0;
printf("Enter number of rows and columns");
scanf("%d %d",&iValue1, &iValue2);
Pattern(iValue1, iValue2);
return 0;
}
/*output:-
* Enter number of rows and columns5
5
1 2 3 4 5
1 2 5
1 3 5
1 4 5
1 2 3 4 5
*/