Computer Science, asked by abhinavraj0001, 1 year ago

write a switch case program in java to find SI and CI

Answers

Answered by muakanshakya
1
import java.util.*;
class Choice
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int ch;
System.out.println("enter your choice=");
ch=sc.nextInt();
System.out.println("enter the principal")
double p = sc.nextDouble();
System.out.println("enter the rate");
double r=sc.nextDouble();
System.out.println("enter the time");
double t=sc.nextDouble();
switch(ch)
{
case 1:
double si;
si=p*r*t/100;
System.out.println("the si of this given data is"+si);
break;
case 2:
double amt,ci;
amt=p*(1+r/100)^t;
ci=amt-p;
System.out.println("ci of the given data's is="+ci);
break/;
default:System.out.println("wrong choice");
}
}
}
Similar questions