121k views
4 votes
Which of the following will be output data type of int +int ?

1 Answer

3 votes

Answer:

int data type

Step-by-step explanation:

Given

int + int

Required

Determine the data type of the output

I'll answer this question with the following illustration.

int x = 1

int y = 2

print(x + y)

At line 3, 1 and 2 will be added together.


1 + 2 = 3

And 3 will be printed as integer.

Because 1 and 2 are of type integer.

Hence, when two or more integer variable are added together, the result is also an integer.

User Engie
by
6.1k points