CC108Tutorial6.docx - CC 108 Java Programming 1 Lecturer...

This preview shows page 1 - 2 out of 4 pages.

CC 108 Java Programming 1May-August 2016Lecturer: CHIT SU MONSubject: Java Programming 1Code: CC 108Tutorial 61.How do you simplify the following statements using the conditional operator?if (num1 > num2)return num1;elsereturn num2; Answer:number = (number1 > number2)? number1:number2;2.Write a program that generates two random integers under 100 andprompts the user to enter the sum of these two integers. The program then reports true if the answer is correct, false otherwise.

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture