For Loop:
Showing posts with label Information technology. Show all posts
Showing posts with label Information technology. Show all posts
switch case
Switch Case Program
Write a program to print the output depending upon the input.
Write a program to check the letter and print it is vowel or consonant:
First Method:
Second method:
Write a program to print the day corresponding to the number. If 1 is the number then day is Sunday:
class switch_month
{
public static void main()
{
int num=5;
switch(num)
{
case (1):
System.out.println(num+ " is January");
break;
case (2):
System.out.println(num+ " is Feburary");
break;
case (3):
System.out.println(num+ " is March");
break;
case (4):
System.out.println(num+ " is April");
break;
case (5):
System.out.println(num+ " is May");
break;
case (6):
System.out.println(num+ " is June");
break;
case (7):
System.out.println(num+ " is July");
break;
case (8):
System.out.println(num+ " is August");
break;
case (9):
System.out.println(num+ " is September");
break;
case (10):
System.out.println(num+ " is October");
break;
case (11):
System.out.println(num+ " is November");
break;
case (12):
System.out.println(num+ " is December");
break;
default:
System.out.println("The number is out of the range 1 to 12");
}
}
}
If else If
If Else If Practical:
WAP to accept student name, mathematics marks and check the grade.
WAP to accept customer's name and total purchase amount, depending upon the purchase amount give discount ,calculate and display amount to be paid.
WAP to accept person name ,number of years of investment and accordingly calculate and display the accumulated amount
WAP to accept customer's name ,ticket amount and accordingly calculate the discount amount , amount to be paid.
WAP to accept name ,roll-on ,marks of physics ,chemistry ,biology. calculate the science marks and give the grade.
Subscribe to:
Posts (Atom)