-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunction.c
More file actions
41 lines (38 loc) · 728 Bytes
/
function.c
File metadata and controls
41 lines (38 loc) · 728 Bytes
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
#include<stdio.h>
int main()
{
int m,n,i,j,mat[30][30],s,value;
printf("Enter the limit for m and n:");
scanf("%d %d",&m,&n);
printf("Enter the matrix values");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
scanf("%d",&mat[i][j]);
}
}
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
value=mat[i][j];
s=sum(value);
if(s%2!=0)
{
printf("\n%d",mat[i][j]);
}
}
}
}
int sum(int value)
{
int digit,s=0;
while(value>0)
{
digit=value%10;
value=value/10;
s=s+digit;
}
return s;
}