Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.50 KB | None | 0 0
  1. program ex9;
  2. uses crt;
  3. var
  4. t:array[1..50]of integer;
  5. x,i,a,n:integer; cha,ch:string;
  6.  
  7. begin
  8.     repeat
  9.         writeln('donner N'); readln(n);
  10.     until n in [5..50];
  11.     for i:=1 to n do
  12.     repeat
  13.         writeln('t[',i,']= '); read(t[i]);
  14.     until t[i] > 0;
  15.    
  16.     for i:=1 to n do
  17.     begin
  18.     cha:=''; a:=0; x := t[i];
  19.     repeat
  20.         a:=x mod 2;
  21.         str(a,cha);
  22.         ch:=ch+cha;
  23.         x:= trunc(x div 2);
  24.     until x = 0;
  25.     writeln(t[i],' = ',ch);
  26.     end;
  27. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement