-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHamming_Distance.fprg
71 lines (71 loc) · 3.81 KB
/
Hamming_Distance.fprg
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?xml version="1.0"?>
<flowgorithm fileversion="2.11">
<attributes>
<attribute name="name" value=""/>
<attribute name="authors" value="Swaraj"/>
<attribute name="about" value=""/>
<attribute name="saved" value="2022-01-23 10:21:12 AM"/>
<attribute name="created" value="U3dhcmFqO1JJU0hJU0FJOzIwMjItMDEtMjM7MDk6NTk6MjkgQU07MjQ5NQ=="/>
<attribute name="edited" value="U3dhcmFqO1JJU0hJU0FJOzIwMjItMDEtMjM7MTA6MjE6MTIgQU07MTsyNTc2"/>
</attributes>
<function name="Main" type="None" variable="">
<parameters/>
<body>
<declare name="i, N, count" type="Integer" array="False" size=""/>
<declare name="sorn" type="String" array="False" size=""/>
<declare name="str1" type="String" array="True" size="10"/>
<declare name="str2" type="String" array="True" size="10"/>
<declare name="num1" type="Integer" array="True" size="10"/>
<declare name="num2" type="Integer" array="True" size="10"/>
<output expression=""Do you want to enter strings or numbers"" newline="True"/>
<output expression=""press s for string"" newline="True"/>
<output expression=""press n for number"" newline="True"/>
<input variable="sorn"/>
<assign variable="count" expression="0"/>
<if expression="sorn=="n"">
<then>
<output expression=""How many numbers do you want to enter into the array"" newline="True"/>
<input variable="N"/>
<output expression=""Enter the numbers for array1"" newline="True"/>
<for variable="i" start="0" end="N-1" direction="inc" step="1">
<input variable="num1[i]"/>
</for>
<output expression=""Enter the numbers for array2"" newline="True"/>
<for variable="i" start="0" end="N-1" direction="inc" step="1">
<input variable="num2[i]"/>
</for>
<for variable="i" start="0" end="N-1" direction="inc" step="1">
<if expression="num1[i]==num2[i]">
<then/>
<else>
<assign variable="count" expression="count+1"/>
</else>
</if>
</for>
</then>
<else>
<output expression=""How many characters do you want to enter into the array"" newline="True"/>
<input variable="N"/>
<output expression=""Enter the characters for array1"" newline="True"/>
<for variable="i" start="0" end="N-1" direction="inc" step="1">
<input variable="str1[i]"/>
</for>
<output expression=""Enter the characters for array2"" newline="True"/>
<for variable="i" start="0" end="N-1" direction="inc" step="1">
<input variable="str2[i]"/>
</for>
<for variable="i" start="0" end="N-1" direction="inc" step="1">
<if expression="str1[i]==str2[i]">
<then/>
<else>
<assign variable="count" expression="count+1"/>
</else>
</if>
</for>
</else>
</if>
<output expression=""The hamming distance is "" newline="True"/>
<output expression="count" newline="False"/>
</body>
</function>
</flowgorithm>