Computer Science, asked by rk4577232, 10 months ago

write any programs to check multiple condition using if statement​

Answers

Answered by yash197911
0

♡HEYA, MATE.....

\large{\mathbf{\green{\underline{\underline{\bigstar JAVA\:EXPERT \bigstar}}}}}

\huge\boxed{\mathfrak{\red{\underline{\underline{|| \:\star QUESTION: \: ||}}}}}

◇Write any programs to check multiple condition using if statement.◇

\huge{\mathfrak{\blue{\underline{\underline{\overline{\overline{|| \: \star ANSWER: \: ||}}}}}}}

A PROGRAM IN JAVA TO SHOW THE USAGE OF IF, DO, WHILE AND CONTINUE STATEMENTS.

//author :@Dark_Panther(Yash Raj)

//Don't forget to give a star if you like this program and you are free to fork / edit it.

import java.util.*;

public class Calculator

{ //start of class Calculator

public static void main(String args[])

{ //start of main function

Scanner sc = new Scanner(System.in);

double a,b,c,d,e,f,temp;

String n;

System.out.println("--------------------WELCOME--------------------");

System.out.println("");

System.out.println("ENTER YOUR NAME : ");

n=sc.nextLine();

System.out.println("");

do

{ //start of do loop

System.out.println(n+", Do you want to Start/Repeat ");

System.out.println("Type 1 for YES and 0 for NO : ");

temp=sc.nextInt();

System.out.println("");

if(temp==1)

{ // start of if condition to check whether the value of temp is on or not, if yes, run the following:

System.out.print("Enter two integers : ");

a=sc.nextDouble();

b=sc.nextDouble();

c=a+b;

d=a-b;

e=a*b;

f=a/b;

System.out.println("Sum="+c);

System.out.println("Difference="+d);

System.out.println("Product="+e);

System.out.println("Quotient="+f);

System.out.println("");

continue;

} //end of if

else if (temp==0)

{ //check if temp is 0

System.out.println("HAVE A NICE DAY , "+n);

System.out.println("Pls give a star if you like this program :-)");

System.exit(0);

} //end of else if

else

System.out.println("INPUT WRONG");

}while (temp<100); //end of dowhile loop

} //end of main function

} //end of class Calculator

_______________________________

&lt;body bgcolor="mistyrose"&gt;&lt;marquee scrollamount="15"&gt;HOPE YOU GET HELPED&lt;/marquee&gt;&lt;/body&gt;

Follow me if you want continued help on Java......

#BAL

#AnswerWithQuality

Similar questions