Computer Science, asked by shalinisingh12345, 11 months ago

How to write variable description in java

Answers

Answered by Pragya3918red
7

Answer:

The variable description in java is written at the end of the program specifying the variable name, its type and the purpose of using the variable in the program. For example : Let us take into consideration the following program -

Write a program to input two numbers and calculate and display their sum and product.

class Calculate

{

void input (int a, int b)

{

int s = 0, p = 0;

s = a + b;

p = a * b;

System.out.println("The sum is " + s);

System.out.println("The product is " + p);

}

}

Variable description :-

Variable name Type Purpose

1. a int To store the first value

given by the user to

perform the addition and

multiplication.

2. b int To store th second value

given by the user to

perform the addition and

multiplication.

3. s int To calculate and store the

result of adding a and b.

4. p int. To calculate and store the

result of multiplying a and

b.

I HOPE THIS ANSWER WILL HELP YOU AND PLEASE MARK THIS ANSWER THE BRAINLIEST ONE..

Similar questions