Logic:
- There are three types of triangle based on its angles
- Right Angled Triangle: If any one angle is of 90.
- Obtuse Angled Triangle: If any one angle is greater than 90.
- Acute Angled Triangle: If all angles are less than 90.
Algorithm
- Enter three angles as a,b,c
- if(a==90 ||b==90||c==90)
- printf(“Triangle is right angle triangle\n”);
- else if (a>90 ||b>90 || c>90)
- printf(“Triangle is obtuse angle triangle\n”);
- else if(a<90 && b<90 && c<90)
- printf(” Triangle is acute angle triangle\n”);
Program
#include<stdio.h> int main () { printf("**********************************************************\n"); printf("**********************************************************\n"); printf("** WAP to tell the type of triangle based on its angles **\n"); printf("** Created by Sheetal Garg **\n"); printf("** Assistant Professor **\n"); printf("** Phone No:9467863365 **\n"); printf("**********************************************************\n"); printf("**********************************************************\n"); int a,b,c; printf("Enter angles of triangle\n"); scanf("%d%d%d",&a,&b,&c); if(a==90 ||b==90||c==90) printf("Triangle is right angle triangle\n"); else if (a>90 ||b>90 || c>90) printf("Triangle is obtuse angle triangle\n"); else if(a<90 && b<90 && c<90) printf("Triangle is acute angle triangle\n"); return 0; }
Output 1:
********************************************************** ********************************************************** ** WAP to tell the type of triangle based on its angles ** ** Created by Sheetal Garg ** ** Assistant Professor ** ** Phone No:9467863365 ** ********************************************************** ********************************************************** Enter angles of triangle 90 80 10 Triangle is right angle triangle
Output 2:
********************************************************** ********************************************************** ** WAP to tell the type of triangle based on its angles ** ** Created by Sheetal Garg ** ** Assistant Professor ** ** Phone No:9467863365 ** ********************************************************** ********************************************************** Enter angles of triangle 30 40 110 Triangle is obtuse angle triangle
Output 3:
********************************************************** ********************************************************** ** WAP to tell the type of triangle based on its angles ** ** Created by Sheetal Garg ** ** Assistant Professor ** ** Phone No:9467863365 ** ********************************************************** ********************************************************** Enter angles of triangle 60 70 80 Triangle is acute angle triangle