### Write a program that inputs pounds from the user and converts it into kilograms.

public static void main(String[] args) { Scanner x=new Scanner(System.in); float pounds,kg; System.out.println(“Enter weight in pounds = “); pounds=x.nextFloat(); kg=(float) (pounds*0.454); System.out.println(“Kilograms=”+kg); } Output: run: Enter weight in pounds = …

### Write a program that converts a person’s height from inches to centimeters using the formula 2.54*height.

public static void main(String[] args) { Scanner x=new Scanner(System.in); float i,C; System.out.println(“Enter The Height in Inches = “); i=x.nextFloat(); C=(float) (i*2.54); System.out.println(“Height in Centimeters=”+C); } Output: run: Enter The Height …

### Write a program that inputs 4 numbers and calculates the sum, average and product of all the numbers.

public static void main(String[] args) { Scanner x=new Scanner(System.in); int a,b,c,d,sum,pro; float avg; System.out.println(“Enter number”); a=x.nextInt(); System.out.println(“Enter number”); b=x.nextInt(); System.out.println(“Enter number”); c=x.nextInt(); System.out.println(“Enter number”); d=x.nextInt(); sum=a+b+c+d; avg=(a+b+c+d)/4; pro=a*b*c*d; System.out.println(“Sum of …

### Write a program that inputs a number from user and displays it square and cube.

public static void main(String[] args) { Scanner x=new Scanner(System.in); int n,a,b; System.out.println(“Enter number”); n=x.nextInt(); a=n*n; b=n*n*n; System.out.println(“Square is=”+a); System.out.println(“cube is=”+b); } Output: run: Enter  number 6 Square is=36 cube is=216 …

### Q.22 Write a program that inputs 3-digit number and displays its digit in separate three lines.

public static void main(String[] args) { Scanner x=new Scanner(System.in); int n,a,b; System.out.println(“Enter 3 digit number”); n=x.nextInt(); a=n/100; n=n%100; b=n/10; n=n%10; System.out.println(a); System.out.println(b); System.out.println(n); } Output: run: Enter 3 digit number …

### Write a program that inputs pounds from the user and converts it into kilograms.

public static void main(String[] args) { Scanner n=new Scanner(System.in); float pounds, kg; System.out.println(“Enter weight in pounds=”); pounds= n.nextFloat(); kg=(float) (pounds*0.454); System.out.println(“kilograms=”+kg); } } Output run: Enter weight in pounds= 5 …

### Q.25 Write a program that converts a person’s height from inches to centimeters using the formula 2.54*height.

public static void main(String[] args) { Scanner n=new Scanner(System.in); float i,c; System.out.println(“Enter the height inches=”); i= n.nextFloat(); c=(float) (i*2.54); System.out.println(“Height in Centemetrs=”+c); } } Output run: Enter the height inches= …

### .Write a program that inputs amount in rupees find and print it how many 100,50,20,10,5,2,1 rupee notes could be made.

public static void main(String[] args) { Scanner cin=new Scanner(System.in); int rs,hundred,fifty,twenty,ten,five,two,one; System.out.println(“Enter rupees=”); rs=cin.nextInt(); hundred=rs/100; rs=rs%100; fifty=rs/50; rs=rs%50; twenty=rs/20; rs=rs%20; ten=rs/10; rs=rs%10; five=rs/5; rs=rs%5; two=rs/2; one=rs%2; System.out.println(“hundred ruppes are”+hundred); System.out.println(“Fifty …