-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsum of n term-17.fprg
More file actions
36 lines (36 loc) · 1.41 KB
/
sum of n term-17.fprg
File metadata and controls
36 lines (36 loc) · 1.41 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
<?xml version="1.0"?>
<flowgorithm fileversion="3.0">
<attributes>
<attribute name="name" value=""/>
<attribute name="authors" value="JEESHITHA"/>
<attribute name="about" value=""/>
<attribute name="saved" value="2023-01-27 07:15:05 PM"/>
<attribute name="created" value="SkVFU0hJVEhBO0RFU0tUT1AtSTQzVlROVjsyMDIzLTAxLTI3OzA3OjEwOjM0IFBNOzMwMzA="/>
<attribute name="edited" value="SkVFU0hJVEhBO0RFU0tUT1AtSTQzVlROVjsyMDIzLTAxLTI3OzA3OjE1OjA1IFBNOzI7MzE0Mg=="/>
</attributes>
<function name="Main" type="None" variable="">
<parameters/>
<body>
<declare name="n, SUM" type="Integer" array="False" size=""/>
<input variable="n"/>
<assign variable="SUM" expression="sum(n)"/>
<output expression="SUM" newline="True"/>
</body>
</function>
<function name="sum" type="Integer" variable="SUM">
<parameters>
<parameter name="n" type="Integer" array="False"/>
</parameters>
<body>
<declare name="SUM" type="Integer" array="False" size=""/>
<if expression="N==1">
<then>
<assign variable="SUM" expression="1"/>
</then>
<else>
<assign variable="SUM" expression="n*(n+1)/2"/>
</else>
</if>
</body>
</function>
</flowgorithm>