// D test program maxsum.d CSE413 6/99 // Read a sequence of numbers terminated by 0, then // print the sum of the numbers and the largest number // = largest of a and b int max(a,b) { if (a > b) return a; else return b; } int main( ) { int n, largest; // current input number and largest number read int sum; // sum of input numbers // read and process input numbers sum = 0; n = get(); largest = n; while (! n==0) { sum = sum + n; largest=max(n,largest); n = get(); } // print total of input numbers and largest input number sum=put(sum); largest=put(largest); return 0; }