Recommended Time: 2 days
Now that you know operators and how to manipulate data. In this lesson we learn how to make decisions, loops and more. This lesson will teach you to manipulate the flow of execution of your program.
1. Odd or Even
Write a program that requests user for an number and prints out whether the number is odd or even.
2. Leap Year
Write a program that requests user for a year and prints out whether the year is a leap year or not. Print invalid if the year is less than 0.
3. Armstrong Number
Write a program that requests user for a number and prints out whether the number is an Armstrong number or not.
Write a program that requests user for a value and prints out whether the value is a palindrome or not.
5. What Data Type
Write a program that declares a variable of type dynamic and assigns it a value of type int, double, or String, and then uses an if statement to check the type of the variable and print a message to the console accordingly.
Write a program that prints the numbers from 1 to 100, but for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.