C Program to Find Third Angle of a Triangle

C program to find the third angle of a triangle; Through this tutorial, we will learn how to find the third angle of a triangle if two angles are given in c programs.

Programs and Algorithm to Find Third Angle of a Triangle

To find the third angle of a triangle if two angles are given in c programs:

  • Algorithm to find third angle of a triangle
  • C Program to Find Third Angle of a Triangle

Algorithm to find third angle of a triangle

Use the following algorithm to write a program to find the third angle of a triangle if two angles are given; as follows:

  1. Input two angles of triangle from user and store it in some variables.
  2. Compute third angle of triangle using formula c = 180 - (a + b).
  3. Print value of third angle i.e. print c.

C Program to Find Third Angle of a Triangle

/*
 * Given two angles of a triangle, Here is the
 * C program to find third angle
 */

#include <stdio.h>
#define ANGLE_SUM 180

int main() {
 /* Three angles of a triangle */
    float a1, a2, a3;

    /*
     * Take two angles as input from user
     */
    printf("Enter Two Angles of a Triangle :- ");
    scanf("%f %f", &a1, &a2);

    /* Sum of all three angles of a triangle is 180 degrees */
    a3 = ANGLE_SUM - (a1 + a2);

    printf("Third Angle = %0.4f", a3);

    return 0;
}

The output of the above c program; as follows:

Enter Two Angles of a Triangle :- 60 30
Third Angle = 90.0000

Recommended C Programs

AuthorDevendra Dode

Greetings, I'm Devendra Dode, a full-stack developer, entrepreneur, and the proud owner of Tutsmake.com. My passion lies in crafting informative tutorials and offering valuable tips to assist fellow developers on their coding journey. Within my content, I cover a spectrum of technologies, including PHP, Python, JavaScript, jQuery, Laravel, Livewire, CodeIgniter, Node.js, Express.js, Vue.js, Angular.js, React.js, MySQL, MongoDB, REST APIs, Windows, XAMPP, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL, and Bootstrap. Whether you're starting out or looking for advanced examples, I provide step-by-step guides and practical demonstrations to make your learning experience seamless. Let's explore the diverse realms of coding together.

Leave a Reply

Your email address will not be published. Required fields are marked *