Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ada 0.58 KB | None | 0 0
  1. --  phi.adb
  2.  
  3. with Ada.Text_IO, Ada.Integer_Text_IO;
  4. use Ada.Text_IO, Ada.Integer_Text_IO;
  5.  
  6. procedure phi is
  7.    a : Integer;
  8.    b : Integer;
  9.  
  10.    function phi_func (n, o : Integer) return Integer is
  11.    begin
  12.       if n = 0 then
  13.          return (o + 1);
  14.       elsif o = 0 then
  15.          return (phi_func (n - 1, 1));
  16.       else
  17.          return (phi_func (n - 1, phi_func (n, o - 1)));
  18.       end if;
  19.    end phi_func;
  20.  
  21. begin
  22.    Put ("Gib eine Zahl fuer a ein! a = ");
  23.    Get (a);
  24.    Put ("Gib eine Zahl fuer b ein! b = ");
  25.    Get (b);
  26.  
  27.    Put (phi_func (a, b));
  28. end phi;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement