1. Write a program to calculate the area of triangle using formula A=(s(s-a)(s-b)(s-c))^1/2

SOURCE CODE:

#include <stdio.h>
#include<math.h>

int main()
{   float a,b,c,s,A;
    printf("enter the sides of triangle\n");
    scanf("%f %f %f",&a,&b,&c);
    s=(a+b+c)/2.0;
    A=sqrt(s*(s-a)*(s-b)*(s-c));
    printf("Area of the triangle is %f",A);

    return 0;
}

Comments

Popular posts from this blog

2. Basic salary of an employee is input through the keyboard. The DA is 25% of the basic salary while the HRA is 15% of the basic salary. Provident Fund is deducted at the rate of 10% of the gross salary (BS+DA+HRA). Write a program to calculate the Net Salary.

4. Write a program to find the largest of three numbers using nested if else