Answer:
public static String repeat(String text, int repeatCount) {
if(repeatCount < 0) {
throw new IllegalArgumentException("repeat count should be either 0 or a positive value");
}
if(repeatCount == 0) {
return "";
} else {
return text + repeat(text, repeatCount-1);
}
}
Explanation:
Here repeatCount is an int value.
at first we will check if repeatCount is non negative number and if it is code will throw exception.
If the value is 0 then we will return ""
If the value is >0 then recursive function is called again untill the repeatCount value is 0.
<span> change the behavior of the program I think</span>
Answer:
function validateForm(event)
{
event.preventDefault();
var phoneNumber = form.phoneNumber.value;
var userName = form.userName.value;
if(phoneNumber.length!=10)
console.log("Phone Number is Invalid");
if(userName.length<11)
console.log("User Name is Invalid");
}
Are you talking about word processors? If yes, you can edit a document's header and footer so the change reflects on all pages of the document.
The flowchart to reverse digits of an integer may be explained like this: <span>If its a decimal number you could use modulus function to return the first lowest digit in the integer like 45%10 would give you a 5. By doing that you will have the number reversed. Lets see an example of that
Flow: (Lets take for example 123)
num = 123
loop
print num%10 (prints 3)
num = num/10 (num now is 12 - integer division removes remainder)
end loop
result : 321</span>