Given the following program fragment determine the value of
Given the following program fragment, determine the value of the following expression. int one = 4; int two = 17; Expression: one + two % one = Write an assignment statement to calculate the sum of the numbers from 1 through n using Gauss\'s formula: sum = n(n + 1_/2
Solution
21)
result = currentSales*0.03 + BASE_PAY
22)
int one = 4;
int two = 17;
divsion will take place first: two%one => 1
followed by addition one + 1 => 5
one + two % one = 5
23)
sum = (n*(n+1))/2;
