Computer Science, asked by sreeya1126, 5 months ago

Write a program to input a and b using scanner class and find c where c is,
c=a2+2ab+b2
No Spam or I'll report it

Answers

Answered by BrainlyProgrammer
4

Answer:

import java.util.*;

class Cal

{

public static void main (String ar [])

{

Scanner sc=new Scanner (System.in);

int a,b; double c=0.0;

System.out.println("Enter a number");

a=sc.nextInt();

b=sc.nextInt();

c=Math.pow(a,2)+(2*a*b)+Math.pow(b,2);

System.out.println("C="+c);

}

}

Similar questions