Professional Documents
Culture Documents
NIKHIL VISHWANATH TANDEL - Untitled Document
NIKHIL VISHWANATH TANDEL - Untitled Document
forms
Q1. Create a program to find the smallest number among three numbers.
Ans : Code-
public class Smallestnumber
{
public static void main(String[] args)
{
int a=99, b=89, c=190;
if(a<=b && a<=c)
System.out.println(a+" is the smallest number");
else if (b<=a && b<=c)
System.out.println(b+" is the smallest number");
else
System.out.println(c+" is the smallest number");
}
}
Input-
Output-
Experiment No 03:- Develop programs to demonstrate use of in statements and its different
forms
Q3. In the if-else construct which part will be executed if the condition is true.
Ans : In if else if the condition if true the if part will only be executed.
Input-
Experiment No 03:- Develop programs to demonstrate use of in statements and its different
forms
Output-
class Logical {
public static void main(String[] args)
{
int a = 50, b = 10, c = 26, d = 8;
System.out.println("Var1 = " + a);
System.out.println("Var2 = " + b);
System.out.println("Var3 = " + c);
if ((a < b) && (b == c)) {
d = a + b + c;
System.out.println("The sum is: " + d);
}
else
System.out.println("False conditions");
}
}
Experiment No 03:- Develop programs to demonstrate use of in statements and its different
forms
Input-
Output-
Experiment No 03:- Develop programs to demonstrate use of in statements and its different
forms
Input-
Experiment No 03:- Develop programs to demonstrate use of in statements and its different
forms
Output-
Input-
Experiment No 03:- Develop programs to demonstrate use of in statements and its different
forms
Output-