In reply to vickydhudashia:
constraint array_c {
foreach (array1[i])
array1[i].sum(item) with ((item < 80) ? item : 101) == 100;
}
You first try was very close. Your cast int’(item) < 80 is unnecessary because the width of the conditional expression does not propagate to the result of the conditional operator ?:— it’s just true or false. The result width is the maximum width of the second(true) or third(false) operand. Since the false operand is plain decimal number, its width is at least 32 bits, so the result will be at least 32 bits
That third operand needs to be a value greater than 100 so that item < 80 must always be true.