1) program Conflict;               2) program Recur;
   var Name:char;                     procedure Stack;
   procedure Boring;                    var ch:char;
     var Name:char;                     begin
     begin                                read(ch);
       Name:='B';                         if not eoln then Stack;
       writeln(Name)                      write(ch)
     end;                               end;
   begin                              begin
     Name:='A';                         writeln('Enter a sentence:');
     writeln(Name);                     Stack;
     Boring;                            writeln
     writeln(Name)                    end.
   end.                       Was that a Toyota I saw?
                              ?was I atoyoT a taht saW

3) program Undig;
   var data:integer;
     procedure reversedig(number:integer);
     begin
       write(number mod 10:1);
       if (number div 10) <> 0 then reversedig(number div 10)
     end;
   begin                                     procedure loop(n:integer);
     writeln('Enter a positive number:');    begin
     readln(data);                             repeat
     reversedig(data);                           write(n mod 10:1);
     writeln                                     n:=n div 10
   end.                                        until n=0;
                                             end;

4) program Print;                      5)program summer;
   procedure echo;                       var bound:integer;
   var ch:char;                          function sum(limit:integer):integer;
   begin                                 begin
     read(ch);  write(ch);                 if limit=1
     if ch<>'.' then echo                    then sum:=limit
   end;                                      else sum:=limit+sum(limit-1)
   begin                                 end;
     writeln('Type a sentence');         begin
     writeln; echo; writeln                write('Enter a number:');
   end.                                    readln(bound);
                                           writeln('The sum is:',sum(bound))
                                         end.

6) program factorial;                   7) function power(x:real; n:integer);
   var bound:integer;                      begin
   function fact(limit:integer):integer;     if n=1
     begin                                     then power:=x
       if (limit=0) or (limit=1)               else power:=x*power(x,n-1)
         then fact:=1                      end;
         else fact:=limit*fact(limit-1)
     end;                                  function fib(n:integer):integer;
   begin                                   begin
     writeln('Enter n:');                    if (n=1) or (n=2)
     readln(bound); writeln(fact(bound))       then fib:=1
   end.                                        else fib:=fib(n-1)+fib(n-2)
                                           end;

   


   8) program sum;
      type list=array[1..10] of integer;
      var ar:list;
          i:integer;
      function asum(a:list; low, high:integer):integer;
      begin
        if low=high
          then asum:=a[low]
          else asum:=a[low] + asum(a, low+1, high)
      end;
      begin
        for i:=1 to 10 do
          readln(ar[i]);
        writeln(asum(ar,1,10))
      end.

   9) ar[0]:=-maxint;
      procedure insert(var a:list; high,x:integer);
      begin
        if a[high-1]<=x
          then a[high]:=x
          else begin
            a[high]:=a[high-1];
            insert(a, high-1, x)
          end
      end;
      procedure insertsort(var a:list; high:integer);
      begin
        if high>0
          then begin
            insertsort(a, high-1);
            insert(a, high, a[high])
          end
      end;
     insertsort(ar, 10);
     
   10) program Hanoi;
   var n:integer;
   procedure move(n:integer; from, to, using:char);
   begin
     if n=1
       then begin
              write('Move disk from ');  write(from);
              write('  to  ');  write(to);
              writeln
            end
       else begin
              move(n-1,from, using, to);
              write('Move disk from ');
              write(from);
              write('  to  ');
              write(to);
              writeln;
              move(n-1, using, to, from)
            end
     end;
     begin
       write ('Enter number of disks: ');    readln(n);
       move(n, 'A', 'C', 'B')
     end.