1. Display the cost of 12 pencil cost of 5 pencil is 12 :
Code:
class gk
{
public static void main(String arg[])
{
float a=12.0f;
int f=5;
//cost of 5 pencil = 12
float x= (a/f); //icost of 1 pencil
float b=(x*a);//cost of 12 pencil
System.out.println("bil -> "+b);
}
}
2. Convert the temperature as input = F and output =C .
Code :
class ftoc
{
public static void main(String arg[])
{
System.out.println("ENTER THE TEMPRATURE->"+arg[0]);
float fahrenheit=Integer.parseInt(arg[0]);
float celsius = ((fahrenheit-32)*5/9);
System.out.println(" CONVERTED TEMPRATURE ->"+celsius);
}
}
3. Display cheap and expensive for given book cost . compair with 1000 .
Code:
class chex
{
public static void main(String arg[])
{
System.out.println("ENTER THE PROCE OF BOOK ->"+arg[0]);
int a=Integer.parseInt(arg[0]);
int b=1000;
if (a>b)
{
System.out.println("expensive");
}
else
{
System.out.println("cheep");
}
}
}
4. Display more or less or equal for entered number , no is more then 500 .
Code :
class cmpr
{
public static void main(String arg[])
{
System.out.println("ENTER THE NUMBER->"+arg[0]);
int a=Integer.parseInt(arg[0]);
int b=500;
if (a>b)
{
System.out.println("enterd no is greater then 500");
}
else if (a<b)
{
System.out.println("enterd no is less then 500");
}
else
{
System.out.println("enterd no is equal to 500");
}
}
}
5. Display got admission or not admission on the bases of entered % . (Got admission % is 70 ) .
Code:
class adm
{
public static void main(String arg[])
{
System.out.println("ENTER THE % of student->"+arg[0]);
int a=Integer.parseInt(arg[0]);
int b=70;
if (a>b)
{
System.out.println("get admition");
}
else
{
System.out.println("not admition");
}
}
}
6. Display got admission or not admission on the bases of entered Hindi , English , Math , Computer marks .( Got admission % is more then 70 ) .
Code:
class madm
{
public static void main(String arg[])
{
System.out.println("ENTER THE MARKS of student IN HINDI->"+arg[0]);
System.out.println("ENTER THE MARKS of student IN ENGLISH ->"+arg[1]);
System.out.println("ENTER THE MARKS of student IN MATH ->"+arg[2]);
System.out.println("ENTER THE MARKS of student IN COMPUTER ->"+arg[3]);
int a=Integer.parseInt(arg[0]);
int b=Integer.parseInt(arg[1]);
int c=Integer.parseInt(arg[2]);
int d=Integer.parseInt(arg[3]);
int e=(a+b+c+d)/4;
int f=70;
if (e>f)
{
System.out.println("get admition");
}
else
{
System.out.println("not admition");
}
}
}
7. Display the smaller for two numbers .
Code:
class cmcm
{
public static void main(String arg[])
{
System.out.println("ENTER 1st no.>"+arg[0]);
System.out.println("ENTER 1st no.>"+arg[1]);
int a=Integer.parseInt(arg[0]);
int b=Integer.parseInt(arg[1]);
if (a>b)
{
System.out.println("in both greater is"+a);
}
else
{
System.out.println("in both greater is"+b);
}
}
}
8. Display illegible or not illegible on the in bothof math and science marks . Marks should be 60 % .
Code :
class ms
{
public static void main(String arg[])
{
System.out.println("ENTER marks of math ->"+arg[0]);
System.out.println("ENTER marks of science ->"+arg[1]);
int a=Integer.parseInt(arg[0]);
int b=Integer.parseInt(arg[1]);
if (a>=60 && b>=60)
{
System.out.println("elegible");
}
else
{
System.out.println("not elegible");
}
}
}
9. Display illegible or not illegible on the in bothof math and science marks . Marks should be 60 % both .
Code :
class mss
{
public static void main(String arg[])
{
System.out.println("ENTER marks of math ->"+arg[0]);
System.out.println("ENTER marks of science ->"+arg[1]);
int a=Integer.parseInt(arg[0]);
int b=Integer.parseInt(arg[1]);
if (a>=60 || b>=60)
{
System.out.println("elegible");
}
else
{
System.out.println("not elegible");
}
}
}
20. Display the smaller for three numbers .
Code :
class cmcm
{
public static void main(String arg[])
{
System.out.println("ENTER 1st no.>"+arg[0]);
System.out.println("ENTER 1st no.>"+arg[1]);
System.out.println("ENTER 1st no.>"+arg[2]);
int a=Integer.parseInt(arg[0]);
int b=Integer.parseInt(arg[1]);
int c=Integer.parseInt(arg[2]);
if ((a>b) && (a>c))
{
System.out.println("in these greater is"+a);
}
else if ((a<b) && (b>c))
{
System.out.println("in bothese greater is"+b);
}
else
{
System.out.println("in these greater is"+c);
}
}
}