Answer:
Following is the expression written in "Bash script" (mixture of commands):
^\d{5}(?:[-\s]\d{4})?$
Explanation:
- ^ = For staring string (denotation).
- \d{5} = Matching 5 digits (first five unknown x's)
- (?:…) = Making Group (making group of former 5 digits)
- [-\s] = Match a hyphen or a space
(checking if a hyphen is present?)
- \d{4} = Matching 4 digits (next four unknown x's)
- …? = Pattern before it is optional
- $ = Ending of the string.(denotation)
It depends on price, brand, number of bottles per case, and number of fluid ounces per bottle.
(price per bottle x number of bottles per case) x 30
Answer:
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
while(true) {
System.out.print("Enter an integer (0 to exit): ");
int num = scan.nextInt();
if (num == 0) break;
if (num%3 == 0 && num%5 == 0) {
System.out.printf("%d is divisable by both 3 and 5.\n", num);
}
else if (num%3 == 0 && num%5 != 0) {
System.out.printf("%d is divisable by 3 but not by 5.\n", num);
}
else if (num%3 != 0 && num%5 == 0) {
System.out.printf("%d is divisable by 5 but not by 3.\n", num);
} else {
System.out.printf("%d is not divisable by 3 or 5.\n", num);
}
}
scan.close();
}
}
Solution :
Public Function Is a Leap_Year(Year As_Integer) As Integer
'Dim Tor_F for local variable declaring if value is t/f.
Dim TorF As For Boolean
'Pre conditions: Year > 1581 and Year < 3000
If Year > 1581 And Year <> 1700 Or 1800 Or 1900 Then
IsLeapYear = Year / 4
Else
IsLeapYear = False
TorF = False
End If
End Function