Answer :
Written in java
import java.util.Scanner;
public class Main{
public static void main(String[] args) {
int year;
Scanner scanner = new Scanner(System.in);
System.out.print("Please enter a year\n\n");
year = scanner.nextInt();
while (year < 1582) {
System.out.print("\nPlease enter a different year above 1582\n");
year = scanner.nextInt();
}
if (year % 4 == 0) {
if(year % 100 ==0 && year % 400 != 0){
System.out.println(year + " is not a leap year\n\n");
}else {
System.out.println(year + " is a leap year\n");
}
} else {
System.out.println(year + " is not a leap year\n\n");
}
}
}
Answer:
EXAMPLE -
Create a variable and assign your age
var myage = 32;
type your age:
console.log(my age) ;
Notice that we did not type the actual numeric age. We used the variable instead. There wouldn’t be any purpose of declaring a variable if we were going to type 32 directly.
This makes the scrip more portable which means that the result on the screen is independent of the code console.log(myAge); . If we need to change our age all we have to do is to assign another number to the variable myAge and the output will change automatically. That’s the purpose of a variable.
Answer:
21
Explanation:
The values of c that make it into the loop are 1, 4, 7.
The values that are added to sum are 3 higher, i.e., 4,7 and 10.
The sum of those is 21.
p.s. why did you not run the program yourself?