Facebook
From Beige Capybara, 5 Years ago, written in Plain Text.
This paste is a reply to Untitled from Ample Hornbill - view diff
Embed
Download Paste or View Raw
Hits: 348
  1. Module Module1
  2.     Function suma(ByVal n As Double, ByRef x() As Double) As Double
  3.  
  4.         Dim res As Double
  5.         If n = 1 Then
  6.             res = x(n)
  7.         Else
  8.             res = x(n) + suma(n - 1, x)
  9.         End If
  10.  
  11.         Return res
  12.  
  13.     End Function
  14.  
  15.     Sub Main()
  16.  
  17.         Dim x(100), n As Double
  18.  
  19.         Console.WriteLine("podaj ilosc elementow: ")
  20.         n = Console.ReadLine()
  21.  
  22.         For i = 1 To n
  23.             Console.WriteLine("podaj element nr{0}: ", i)
  24.             x(i) = Console.ReadLine()
  25.         Next
  26.  
  27.         Console.WriteLine("Suma elementow ciagu: {0}", suma(n, x))
  28.  
  29.         Console.ReadKey()
  30.  
  31.  
  32.     End Sub
  33.  
  34. End Module

Replies to Re: Untitled rss

Title Name Language When
Re: Re: Untitled Cute Ibis text 5 Years ago.