An electronic device comprising: a foldable housing including a first housing part that includes a first surface and a second surface facing opposite to the first surface, a second housing part including a first surface that faces the first surface of the first housing part when the housing is folded in a first direction and a second surface that faces the second surface of the first housing part when the housing is folded in a second direction, and a connector configured to connect the first housing part to the second housing part; a first display disposed on the first surface of the first housing part; a second display disposed on the second surface of the second housing part; a first sensor disposed in the first housing part; a second sensor that is disposed in the second housing part; a third sensor that is disposed in the first housing part and a fourth sensor that is disposed in the second housing part; and a processor that is configured to identify an angle between the first housing part and the second housing part using the first sensor, the second sensor, the third sensor and the fourth sensor, wherein the first sensor and the second sensor are acceleration sensors and the third sensor and the fourth sensor are gyro sensors, and execute at least one action of the electronic device based on the identified angle; characterized in that the processor, is further configured to: measure a first angle between the first housing part and a ground, to measure a second angle between the second housing part and the ground; identify an angle between the first housing part and the second housing part using data obtained from the acceleration sensors if at least one of the first angle and the second angle is equal to or less than a predetermined angle; and identify an angle between the first housing part and the second housing part using a quaternion vector if both the first angle and second angle exceeds the predetermined angle. a foldable housing including a first housing part that includes a first surface and a second surface facing opposite to the first surface, a second housing part including a first surface that faces the first surface of the first housing part when the housing is folded in a first direction and a second surface that faces the second surface of the first housing part when the housing is folded in a second direction, and a connector configured to connect the first housing part to the second housing part; a first display disposed on the first surface of the first housing part; a second display disposed on the second surface of the second housing part; a first sensor disposed in the first housing part; a second sensor that is disposed in the second housing part; a third sensor that is disposed in the first housing part and a fourth sensor that is disposed in the second housing part; and a processor that is configured to identify an angle between the first housing part and the second housing part using the first sensor, the second sensor, the third sensor and the fourth sensor, wherein the first sensor and the second sensor are acceleration sensors and the third sensor and the fourth sensor are gyro sensors, and execute at least one action of the electronic device based on the identified angle; characterized in that the processor, is further configured to: measure a first angle between the first housing part and a ground, to measure a second angle between the second housing part and the ground; identify an angle between the first housing part and the second housing part using data obtained from the acceleration sensors if at least one of the first angle and the second angle is equal to or less than a predetermined angle; and identify an angle between the first housing part and the second housing part using a quaternion vector if both the first angle and second angle exceeds the predetermined angle. measure a first angle between the first housing part and a ground, to measure a second angle between the second housing part and the ground; identify an angle between the first housing part and the second housing part using data obtained from the acceleration sensors if at least one of the first angle and the second angle is equal to or less than a predetermined angle; and identify an angle between the first housing part and the second housing part using a quaternion vector if both the first angle and second angle exceeds the predetermined angle.