// D test program maxsum.d CSE413 6/99, rev 5/00 // 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(int a, int b) { if (a > b) return a; else return b; } int main( ) { int n; // current input number int largest; //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; }