Sunteți pe pagina 1din 5

SUPPLEMENTRY ASSIGNMENT 3B

ARUNKRISHNAN PP
CLASS:S7 CSE
ROLL NO :11

I REWRITE MY PREDICATE AS :  x,y{H(x) ∧H(y)} R(x,y)

Interpretation
x,y – set of positive integer
H- even integer
R- even integer and have two arguments and return true if x mod y is even

VENN DIAGRAMS

8 2 2
8
16 4 4
16
32 7 7
32

X Y R
C Implementation

1. #include<stdio.h>
2. #include<math.h>
3. #include<string.h>
4. int ISEVEN(int a)
5. {
6. if(a%2==0)
7. {
8. return 0;
9. }
10.else
11.{
12.return 1;
13.}
14.}
15.int R(int k,int l)
16.{
17.int c=k%l;
18.if(c%2==0)
19.{
20.return 0;
21.}
22.else
23.{
24.return 1;
25.}
26.}
27.void main()
28.{
29.int flag=0;
30.int b,c;
31.int i,j;
32.int x[3]= {8,16,32};
33.int y[3]={2,4,7};
34.for(i=0;i<3;i++)
35.{
36.for(j=0;j<3;j++)
37.{
38.if(ISEVEN(x[i])==0&&ISEVEN(y[j])==0)
39.{
40.int v=R(x[i],y[j]);
41.if(v==0)
42.{
43.//flag=1;
44.printf("%d relation %d is TRUE LHS AND RHS satisfie \n",x[i],y[j]);
45.}
46.else
47.{
48.flag=0;
49.printf("%d relation %d is FALSE becouse RHS didnt satisfie\n",x[i],y[j]);
50.}
51.}
52.else
53.printf("%d relation %d is FALSE LHS didnt satisfie\n",x[i],y[j]);
54.}
55.}
56./*if(flag==1)
57.{
58.printf("true");
59.}
60.else
61.("false");*/
62.}
63.Output

OUTPUT
Out put are showing false case because the input given is implying false result
Input( x={8,16,32};
Y={2,4,7}; )

8 relation 2 is TRUE LHS AND RHS satisfie


8 relation 4 is TRUE LHS AND RHS satisfie
8 relation 7 is FALSE LHS didnt satisfie
16 relation 2 is TRUE LHS AND RHS satisfie
16 relation 4 is TRUE LHS AND RHS satisfie
16 relation 7 is FALSE LHS didnt satisfie
32 relation 2 is TRUE LHS AND RHS satisfie
32 relation 4 is TRUE LHS AND RHS satisfie
32 relation 7 is FALSE LHS didnt satisfie
NAME VALUE SCOPE ACTUAL
BINDING
OCCURE AT
c Numeric value 16-19 30
i Numeric value 34-63 34
1,2,3
j Numeric value 34-63 34
1,2,3
x array 32-63 32
y array 32-63 33
v Integer value 40-45 40
a integer 6-9 6
k Function 15-26 15
parameter
l Function 15-26 15
parametr
void Non value Entire program 27
returning
functiom
int Integer data type 29……..entire 29
program
If If function Between end of 06,18,38,41
function

else Else function Between end of 06,18,38,41


function
for Fo loop 36-55 36
% Modulus operator 6,18 on 6,18
calculation
== Checking operator 6,38 on checking 6,38
printf Built in function Entire program 49,53
for print
ISEVEN User defind 4-14 38
function for
checking even
R User defind 15-26 40
function for R
main function Entire program 27

----------------------------static binding is occurring at the compile time In c


programing

S-ar putea să vă placă și