-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBiggestObj.c
57 lines (53 loc) · 1.3 KB
/
BiggestObj.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
47
48
49
50
51
52
53
54
55
56
57
#include <stdlib.h>
#include <stdio.h>
void main()
{
int rows;
int columns;
int i,j;
int size=1;
printf("Enter the number of rows:\n");
scanf("%d",&rows);
printf("Enter the number of columns:\n");
scanf("%d",&columns);
int array[rows+1][columns+1];
for(i=0;i<=rows;i++) //loop to initialize the array
{
for(j=0;j<=columns;j++)
{
array[i][j]=0;
}
}
printf("Enter the contents of the array:\n"); //Loop to take input
for(i=0;i<rows;i++)
{
printf("Enter the contents of Row %d \n",(i+1));
for(j=0;j<columns;j++)
{
scanf("%d",&array[i][j]);
}
}
printf("The entered list is:\n"); //Loop to display the array
for(i=0;i<=rows;i++)
{
for(j=0;j<=columns;j++)
{
printf("%d \t",array[i][j]);
}
printf("\n");
}
for(i=0;i<rows;i++) //Main Loop to find the biggest Object.
{
for(j=0;j<columns;j++)
{
if(array[i][j])
{
while(array[i+size][j] && array[i+size][j+size] && array[i][j+size])
{
size++;
}
}
}
}
printf("The biggest Object has the size of %d",size);
}