-
Notifications
You must be signed in to change notification settings - Fork 0
/
frequncy_in_an_array (2) (1).fprg
41 lines (41 loc) · 2.49 KB
/
frequncy_in_an_array (2) (1).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
<?xml version="1.0"?>
<flowgorithm fileversion="3.0">
<attributes>
<attribute name="name" value=""/>
<attribute name="authors" value="chennavaram arnav"/>
<attribute name="about" value=""/>
<attribute name="saved" value="2022-12-09 10:35:38 PM"/>
<attribute name="created" value="Y2hlbm5hdmFyYW0gYXJuYXY7QVJOQVZST0ctQ0xTMlFPOzIwMjItMTItMDk7MTA6MjE6MDEgQU07NDA2NQ=="/>
<attribute name="edited" value="Y2hlbm5hdmFyYW0gYXJuYXY7QVJOQVZST0ctQ0xTMlFPOzIwMjItMTItMDk7MTA6MzU6MTIgQU07MTs0MTgw"/>
<attribute name="edited" value="SFA7REVTS1RPUC1MM1JERUtGOzIwMjItMTItMDk7MTE6MjU6MDQgQU07NzsyNjAw"/>
<attribute name="edited" value="S29sbHVydSBTcmluaXZhcztERVNLVE9QLTcwQ045TFQ7MjAyMi0xMi0wOTsxMDozNTozOCBQTTsyOzQwNjg="/>
</attributes>
<function name="Main" type="None" variable="">
<parameters/>
<body>
<comment text="declaring integer array ,input and x,frequency"/>
<declare name="array" type="Integer" array="True" size="10"/>
<declare name="input, freq, x, value" type="Integer" array="False" size=""/>
<comment text="here we are declaring x and using for loop when x values go from 0 to 9 we will give input number which it will store in integer array "/>
<for variable="x" start="0" end="9" direction="inc" step="1">
<output expression=""Enter "&x+1&" value"" newline="True"/>
<input variable="input"/>
<assign variable="array[x]" expression="input"/>
</for>
<output expression=""Enter the value for which the frequency should be found"" newline="True"/>
<comment text="here now we are asking the number on which the frequency shoulld be found"/>
<input variable="value"/>
<assign variable="freq" expression="0"/>
<comment text="here we are assuming that frequency is=0and we are using if statement if the array[x]=value then frequency =frequency+1"/>
<for variable="x" start="0" end="9" direction="inc" step="1">
<if expression="array[x]=value">
<then>
<assign variable="freq" expression="freq+1"/>
</then>
<else/>
</if>
</for>
<output expression=""The frequency of the given value in array is "&freq" newline="True"/>
</body>
</function>
</flowgorithm>