Computer Applications
Write algorithms and draw flowcharts for the following:
Accept three numbers and check whether they are 'Pythagorean Triplets' or not. Display the message accordingly.
(Hint: Use Pythagoras Formula for a Right-angled Triangle: h = p2+b2)
Algo & Flowcharts
206 Likes
Answer
Algorithm
Step 1: Start
Step 2: Take 3 numbers as input (Say A,B,C)
Step 3: If A2 = B2 + C2, display 'Pythagorean Triplets'
Step 4: If B2 = A2 + C2, display 'Pythagorean Triplets'
Step 5: If C2 = A2 + B2, display 'Pythagorean Triplets'
Step 6: If no condition of Step 3,4,5 match, display 'Not Pythagorean Triplets'
Step 7: Stop
Flowchart

Answered By
136 Likes
Related Questions
Write algorithms and draw flowcharts for the following:
Accept the length of two different line segments and check whether they are equal or unequal. Display the message accordingly.
Write algorithms and draw flowcharts for the following:
Accept the age of a person and check whether he/she is eligible to vote or not. A person is eligible to vote only when he/she is 18 years or more.
In a cricket match, a viewer carries a laptop in the stadium every day to keep record of the runs made by each batsman. When a player comes to bat, the viewer enters the previous runs made by the player. Further, he enters the runs scored for each ball. When the runs entered on a ball is -1, it means the player is out. The laptop then displays the runs made by the player in the current innings as well as the total. The process continues until all the players are out. Draw a flowchart for the task stated above.
Draw flowchart for the following:
Accept a number and check:
(a) whether the number is divisible by 2 and 5.
(b) whether the number is divisible by 2 but not by 5.
(c) whether the number is divisible by 5 but not by 2.
Display the message accordingly