Advertisement
TRiBLy

Untitled

Nov 2nd, 2011
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ada 1.66 KB | None | 0 0
  1. with Ada.Integer_Text_IO;                                                      
  2. use Ada.Integer_Text_IO;                                                      
  3. with Ada.Text_IO;                                                              
  4. use Ada.Text_IO;                                                              
  5.                                                                                
  6. procedure recursion is                                                        
  7.    function rec (N : Natural) return Natural is                                
  8.                                                                                
  9.    begin                                                                      
  10.       Put_Line (Integer'Image (N));                                            
  11.                                                                                
  12.       if N = 1 then                                                            
  13.          return 1;                                                            
  14.       else                                                                    
  15.          return rec (N - 1);                                                  
  16.       end if;                                                                  
  17.    end rec;                                                                    
  18.                                                                                
  19.    N : Integer;                                                                
  20. begin                                                                          
  21.    rec (10);                                                                  
  22. end recursion;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement