Saturday, August 1, 2015

Exercise

Exercise 1 :-Write a program to identify whether a character entered by a user is a vowel or a consonant.
Write a program to identify whether the number entered by a user is even or odd.
Write a program to accept a number from the user and display all the prime numbers 
from one up to the number entered by user.
Write a program to accept two numbers and check if the first is divisible by the second. In addition, an error message should be displayed if the second number is zero.
Exercise 5:-Write a program to accept two numbers and display the quotient as a result. In addition, an error message should be displayed if the second number is zero or greater than the first number.
Exercise 6:-
 Write a program to enter a number from 1 to 7 and display the corresponding day of the week.
Exercise 7:-
 Write a program to display the highest of any 10 numbers entered.
Exercise 8 :-
Write a program to print the product of the first 10 even numbers.
Exercise 9:-
 Enter a year and determine whether the year is a leap year or not. A leap year is a non century year that is divisible by 4. A century year is a year divisible by 100, such as 1900. A century year, which is divisible by 400, such as 2000, is also a leap year. 
Hint: If a year is divisible by 4 and is not divisible by 100 or divisible by 400, it is a leap year.

No comments:

Post a Comment