Write a java program to accept the value of a and b from the user and calculate the value of s, where s=a3+ ab2
Answers
Answered by
3
import java.util.Scanner;
public class Values
{
public static void main (String args);
{
Scanner sc=new Scanner(System.in);
System.out.print("Please enter the value of a : ");
int a = sc.nextInt();
System.out.print("Please enter the value of b : ");
int b = sc.nextInt();
int s = (Math.pow(a,3)) + (Math.pow(a*b,2));
System.out.println("Value of s : "+s);
sc.close();
}
}
Similar questions
Math,
1 day ago
Computer Science,
1 day ago
Geography,
2 days ago
Computer Science,
8 months ago
Biology,
8 months ago