Write a program in Java to input two numbers and calculate the square of the digit at units place of the first number and cube of the digit at units place of the second number. Find and print the sum of the square and the cube
Answers
◼Java is an Object oriented programming which encapsulate many features. Its language which gives more emphasis on object rather than data .Its a platform independence language.
◼Java consists of token, keywords, variables, operator, separator,data types and variables and punctuators.
◼Main parts of a programming are assignment of variables, condition updating.
The following programming is done by scanner Class of Java
import java.util.*;
class check
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
int a, b, r, r1,c=0,s=0,a1,b1,s1=0;
System. out. println("ENTER ANY TWO NUMBERS");
a=in.nextInt();
b=in.nextInt();
a1=a; b1=b;
r=a1/10;
s = r * r;
r1=b1/10;
c = r1 * r1 * r1;
s1= c + s;
System. out. println("THE SUM IS " +s1);
}
}