Project
Project
Project
import java.util.*;
class Ascending
int n1=sc.nextInt();
int n2=sc.nextInt();
int n3=sc.nextInt();
System.out.println("Ascendin\nDescending");
System.out.println("enter choice");
int ch=sc.nextInt();
int res,res1,res2,res3;
switch(ch)
case 1:
res=Math.max(n1,Math.max(n2,n3));
res1=Math.min(n1,Math.min(n2,n3));
res2=Math.max(n1,n2);
res3=Math.min(res2,n3);
System.out.println("Ascending order:"+res+","+res3+","+res1);
break;
case 2:
res=Math.max(n1,Math.max(n2,n3));
res1=Math.min(n1,Math.min(n2,n3));
res2=Math.max(n1,n2);
res3=Math.min(res2,n3);
System.out.println("Descending order:"+res1+","+res3+","+res);
break;
Q2)
import java.util.*;
class AgeDistance
int age=sc.nextInt();
int dist=sc.nextInt();
if(age<10)
if(dist<10)
else if(dist>10&&dist<50)
else
else if(age>10&&age<60)
{
if(dist<10)
else if(dist>10&&dist<50)
else
else
if(dist<10)
else if(dist>10&&dist<50)
else
Q3)
import java.util.*;
class digit
char ch;
Scanner s=new Scanner(System.in);
ch = s.next().charAt(0);
System.out.println("This is an alphabet.");
System.out.println("This is a digit.");
else
Q4)
import java.util.*;
class Lcm
{
public static void main()
int x=sc.nextInt();
int y=sc.nextInt();
int r=0,a,b;
a=(x>y)?x:y;
b=(x<y)?x:y;
r=b;
while(a%b!=0)
r=a%b;
a=b;
b=r;
// int LCM=(x*y)/r;
Q5)
import java.util.Scanner;
int n = in.nextInt();
int sum = 0;
if (n % i == 0)
sum += i;
if (sum > n)
else
Q6)
import java.util.*;
class pattern
System.out.println("Series\nPattern");
System.out.println("enter choice");
int ch=sc.nextInt();
switch(ch)
case 1:
int n=sc.nextInt();
for(int i=2;i<=n;i++)
System.out.print(((i*i)-1)+",");
break;
case 2:
for(int i=5;i>=1;i--)
for(int j=1;j<=i;j++)
if(j%2==0)
System.out.print("0");
else
System.out.print("1");
System.out.println();
break;
}
}
Q7)
import java.util.*;
class equation
double equation(int x)
double p=2.4*Math.pow(x,2)+5.3*x+-1.6;
return p;
void input()
System.out.println("Enter value");
int a=sc.nextInt();
double k=equation(a);
System.out.println("Answer is="+k);
Q8)
import java.util.*;
class honda
byte type;
int cost;
void getType()
type=sc.nextByte();
cost=sc.nextInt();
void find()
if(type==2)
cost=cost*10/100;
if(type==4)
cost=cost*12/100;
void printcost()
System.out.println("Type of engine:"+type);
h.getType();
h.find();
h.printcost();