Computer Science, asked by Slay01k, 2 days ago

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 ItzMeSam35
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