Monday, July 6, 2020
Program to find angles of a triangle if two angles are given
Program to find angles of a triangle if two angles are given:
Write a C program to find third angle of a triangle if any two angles are given by user. How to find and waht is the logic to find angles of a triangle is given below.
Properties of triangle:
Remember: The sum of three interior angles of a triangle is 180°
For Example:
Required knowledge for this exercise is:
Before writing any program you just imagine about output screen first. For example, what input to be given, and output to be displayed. Let's have a look at the below example:
INPUT:
Enter any angles of a triangle = 45, 60
OUTPUT:
Thirs angle of a triangle = 75
Logic to find any angle of a triangle:
Step by step logic to find any angle of a triangle.
1) Print a massage to the user like "Enter any two angle of triangle:" using printf();
2) Input any two angle of a triangle from user using scanf(); and store it in variables a and b.
3) Now find thrid angle of a triangle using farmulla c = 180 - (a + b);
4) At last print the value of variable c. that's it!
Program to find angle of a triangle if two angles are given:
Output:
Next topic >> to be updated soon.
Help others by sharing this page.
Ahmad Irshad
Author & Editor
I love blogging, teaching, learning computer science and sharing it to others. I've written and develped this site so that students may learn computer science related tutorials eaisly. MCA / MCITP
Monday, July 06, 2020
C
Subscribe to:
Post Comments (Atom)
0 Comments:
Post a Comment
Please don't enter any spam link in the comment box.