If & Switch Block
Assignment:
1. Write a program that accepts two integer values from the user and return the larger values.
2. Write a program to compare two numbers use operators like <, >, <=,>=, ==, !=
Input Data:
Input first integer: 25
Input second integer: 39
Expected Output
25 != 39
25 < 39
25 <= 39
3. Check number is even or odd
4. Program to find Largest of three numbers
5. Write a program to calculate the sum of two integers and return true if the sum is equal to a third integer.
Input the first number : 5
Input the second number: 10
Input the third number : 15
Sample Output:
The result is: true
6. Write a program that accepts three integers from the user and return true if two or more of them (integers ) have the same rightmost digit. The integers are non-negative.
Input the first number : 5
Input the second number: 10
Input the third number : 15
Sample Output:
The result is: true
7. Write a program to check whether an given integer is a power of 4 or not.
Given num = 64, return true. Given num = 6, return false.
8. Check leap year
9. Input character is vowel or consonant
10. Given number is positive or negative
11. Program to swap two numbers using bitwise operator
12. Program to find smallest of three numbers using ternary operator
13. Program to find largest of three numbers using ternary operator
14. display Student Grades
15. display month name by digit
ip: 1 op:Jan
2 OP:Feb
16. Identify Quarter
Ex:- 1 ->Q1, 5->Q2, 7->Q3
Switch:
1. display month name by digit
ip: 1 op:Jan
2 OP:Feb
2. display Week name by digit
ip: 1 op:MON
2 OP:TUS
Comments
Post a Comment