Computer Science, asked by jeevikaanthwal9a2103, 3 months ago

2. What will be the resultant type of the following expression if xy is a float variable and pq is a double variable?
(int)(xy + pq)​

Answers

Answered by BrainlyProgrammer
3

Answer:

the Output will be in int data type

Explanation:

The given statement is an example of Type casting

Originally, the output will be in double but the user wants the Output in int data type so he uses type casting

(Here he is forcibly converting the Output in double data type to int data type).

Answered by aaryaswarup
0

Answer:

class q1a{

public static void sumUp(int n, int total){

int i;

for (i=1; i<=n; i++){

total = total +i;

}

}

public static void main(String args[]){

int n, total;

n=10; //n can be initialized to any +ve number

total=0;

sumUp(n, total);

System.out.println(total);

}

}

Explanation:

Similar questions