1. Enter your name and display it.
Coading :
class xyz
{
public static void main(String arg[])
{
System.out.println("GOPAL KRISHNA CHAUHAN");
}
}
2. Enter a number and display it.
Coading :
class xyz
{
public static void main(String arg[])
{
System.out.println("1001910009");
}
}
3. Display the sum of any two numbers.
Coading :
class xyz
{
public int add(int a,int b)
{
return (a+b);
}
}
class pgm3
{
public static void main(String arg[])
{
xyz x=new xyz();
System.out.println("sum="+x.add(2,5));
}
}
4. Display the avg. of given number.
Coading :
class xyz
{
public static void main(String arg[])
{
int a=5;
int b=15;
int d=a+b;
int c=d/2;
System.out.println("avg of two numbers="+c);
}
}
5. Display the bill to pay Raman bought 10 pencil of worth 25/- of and color pens worth 24/- .
Coading :
class xyz
{
public static void main(String arg[])
{
int e=25;
int f=24;
int g=e+f;
System.out.println("Bill of raman ="+g);
}
}
6. Display the bill to pay Raman bought 10 pencils for rs. 2.50 And 12 color pen for 5 each.
Coading :
class xyz
{
public static void main(String arg[])
{
int a=10;
double b=2.50;
int c=12;
int d=5;
int e=c*d;
double f=a*b;
double g=e+f;
System.out.println("Bill of raman ="+g);
}
}
7. Display the entered hour minutes and second into total seconds.
Coading :
class xyz
{
public static void main(String arg[])
{
int a=3;//hour
int b=10;//minut
int c=55;//sec
int d=a*60*60;
int e=b*60;
int f=e+d+c;
System.out.println("total seconds="+f);
}
}
8. Display the electricity bill on the bases of current and previous reading charges reading and charges 1 current unit=3.
Coading :
class xyz
{
public static void main(String arg[])
{
double a=43533.5;
double b=48424.9;
double c=b-a;
int z=3;
double f=c*z;
System.out.println("electricity Bill of the month ="+f);
}
}
9. Display the hotal bil on the bases of invited guest .all other will have sup dinar desert . 8% sails tex will be impose on it .
Coading :
class xyz
{
public static void main(String arg[])
{
int a=14;//guest
int b=35;//soop
int c=125;//dinar
int d=35;//desrt
int e=d+c+b;
int f=a*e;
int g=100*f;
int h=g/8;
System.out.println("bill without tax="+f);
System.out.println("bill with tax="+h);
}
}