Programming In C Practical 12
Question 1
Write a program to check whether the triangle is isosceles, equilateral, scalene or Right-angled triangle.
Triangle.cpp
C
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int x,y,z;
printf("\nEnter three sides of a triangle: ");
scanf("%d%d%d",&x,&y,&z);
if(x==y&&x==z)
printf("\nTriangle is equilateral triangle");
else if(x*x==y*y+z*z||y*y==x*x+z*z||z*z==x*x+y*y)
printf("\nTriangle is right angle triangle");
else if(x==y||y==z||x==z)
printf("\nTriangle is isosceles triangle");
else
printf("\nTriangle is scalene triangle");
getch();
}
Output

Question 2
Display the season -summer, winter, rain for given month of year
Seasons.cpp
C
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int num;
printf("\nEnter number of month: ");
scanf("%d",&num);
if(num>=2&&num<=5)
printf("\nSummer season");
else if(num>=6&&num<=9)
printf("\nRainy season");
else if(num>=10&&num<=12||num==1)
printf("\nWinter season");
else
printf("\nInvalid month");
getch();
}
Output
