Computer Science, asked by students781005, 5 months ago

Write a basic program to solve the expression A^3-B^3 where A = 15, B=6.​

Answers

Answered by jibitesh40
2

A^3-B^3 where A = 15, B=6. So 45-18 = 27.

Answered by dreamrob
0

Program in C++

#include<iostream>

#include<math.h>

using namespace std;

int main()

{

int A , B , C;

cout<<"Enter a number : ";

cin>>A;

cout<<"Enter another number : ";

cin>>B;

C = pow(A,3) - pow(B,3);

cout<<"Answer is : "<<C;

return 0;

}

Program in Java

import java.util.*;

class MyClass {

   public static void main(String args[]) {

     Scanner Sc = new Scanner(System.in);

     int A , B , C;

     System.out.print("Enter a number : ");

     A = Sc.nextInt();

     System.out.print("Enter another number : ");

     B = Sc.nextInt();

     C = (int)Math.pow(A , 3) - (int)Math.pow(B , 3);

     System.out.print("Answer is : " + C);

   }

}

Program in Python

A = int(input("Enter a number : "))

B = int(input("Enter another number : "))

print(A*A*A - B*B*B)

Attachments:
Similar questions