Repository navigation
Expand file tree
/
Copy pathq13.fprg
More file actions
56 lines (56 loc) · 2.4 KB
/
Copy pathq13.fprg
File metadata and controls
56 lines (56 loc) · 2.4 KB
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
<?xml version="1.0"?>
<flowgorithm fileversion="4.2">
<attributes>
<attribute name="name" value="q13"/>
<attribute name="authors" value="Divyam"/>
<attribute name="about" value=""/>
<attribute name="saved" value="2025-08-20 10:45:28 PM"/>
<attribute name="created" value="RGl2eWFtO0xBUFRPUC1LVTdINE1ESTsyMDI1LTA4LTIwOzA2OjA3OjE2IFBNOzI5Njc="/>
<attribute name="edited" value="RGl2eWFtO0xBUFRPUC1LVTdINE1ESTsyMDI1LTA4LTIwOzEwOjQ1OjI4IFBNOzE7MzA3NQ=="/>
</attributes>
<function name="Main" type="None" variable="">
<parameters/>
<body>
<declare name="rem, quot, num, sum" type="Integer" array="False" size=""/>
<assign variable="sum" expression="0"/>
<input variable="num"/>
<call expression="remainder(num,10)"/>
<call expression="quotient(num,10)"/>
<while expression="num>10">
<assign variable="rem" expression="remainder(num,10)"/>
<assign variable="quot" expression="quotient(num,10)"/>
<assign variable="num" expression="quot"/>
<assign variable="sum" expression="sum+rem"/>
</while>
<assign variable="sum" expression="sum+num"/>
<output expression="sum" newline="True"/>
</body>
</function>
<function name="quotient" type="Integer" variable="q">
<parameters>
<parameter name="a" type="Integer" array="False"/>
<parameter name="b" type="Integer" array="False"/>
</parameters>
<body>
<declare name="q" type="Integer" array="False" size=""/>
<assign variable="q" expression="0"/>
<while expression="a>b">
<assign variable="q" expression="q+1"/>
<assign variable="a" expression="a-b"/>
</while>
</body>
</function>
<function name="remainder" type="Integer" variable="r">
<parameters>
<parameter name="a" type="Integer" array="False"/>
<parameter name="b" type="Integer" array="False"/>
</parameters>
<body>
<declare name="r" type="Integer" array="False" size=""/>
<while expression="a>b">
<assign variable="a" expression="a-b"/>
</while>
<assign variable="r" expression="a"/>
</body>
</function>
</flowgorithm>