Write a function in c to find the area of a triangle whose length of three sides is given.
Answer Posted / jenee
/* Write a function to find the area of a triangle whoes length of three sides is given */
#include<stdio.h>
#include<conio.h>
float triangle(float b,float h)
{
float result;
result=(b*h)/2;
return(result);
}
void main()
{
float a,b,ans;
clrscr();
printf("Enter the Base of Triangle : ");
scanf("%f",&a);
printf("Enter the Height of Triangle : ");
scanf("%f",&b);
ans=triangle(a,b);
printf("Area of Triangle is %f",ans);
getch();
}
| Is This Answer Correct ? | 11 Yes | 5 No |
Post New Answer View All Answers
how can I convert a string to a number?
Explain a file operation in C with an example.
Give a one-line C expression to test whether a number is a power of 2. [No loops allowed - it's a simple test.]
How do you do dynamic memory allocation in C applications?
write a c program to find the largest and 2nd largest numbers from the given n numbers without using arrays
Are there namespaces in c?
Is c language still used?
What is volatile keyword in c?
main() { printf("hello"); fork(); }
How can I handle floating-point exceptions gracefully?
What is difference between arrays and pointers?
write a program to find the given number is prime or not
Write a program to replace n bits from the position p of the bit representation of an inputted character x with the one's complement. Method invertBit takes 3 parameters x as input character, p as position and n as the number of positions from p. Replace n bits from pth position in 8 bit character x. Then return the characters by inverting the bits.
i = 25;switch (i) {case 25: printf("The value is 25 ");case 30: printf("The value is 30 "); When the above statements are executed the output will be : a) The value is 25 b) The value is 30 c) The value is 25 The value is 30 d) none
An expression to whose value an operater is applied a) operand b) variable c) constant d) all of the above