31ph4n70m

Maximum_of_array.d

Nov 27th, 2019
531
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
D 0.50 KB | None | 0 0
  1. // D solution to codabbey challenge 15
  2. import std.stdio;
  3. import std.array;
  4. import std.conv;
  5.  
  6. void main() {
  7.     string inp = readln();
  8.     string[300] arr_str = inp.split();
  9.     int[300] RSP;
  10.     int max = 0;
  11.     int min = 0;
  12.     for (int i = 0; i < 300; i++){
  13.         RSP[i] = to!int(arr_str[i]);
  14.     }
  15.     for (int j = 0; j < 300; j++){
  16.         if(RSP[j] > max){
  17.             max = RSP[j];
  18.         }else if(RSP[j] < min){
  19.             min = RSP[j];
  20.         }
  21.     }
  22.     writeln(max, " ", min);
  23. }
Add Comment
Please, Sign In to add comment