Write a function in c to find the area of a triangle whose length of three sides is given.

Answer Posted / reshma

#include<stdio.h>
#include<conio.h>
float triangle (float b, float h)
{
float result;
result=(b*h)/2;
return(result);
}
void main()
{
clrscr();
float a,b,ans;
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 ?    14 Yes 12 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a char c?

592


Explain the term printf() and scanf() used in c language?

597


What are the different properties of variable number of arguments?

666


What is the difference between call by value and call by reference in c?

619


please explain clearly about execution of c program in detail,in which stage are the printf sacnf getting into exeecutable code

1705






Can we declare variable anywhere in c?

535


What does the function toupper() do?

657


what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;

2008


Why do we use int main?

610


write a program to convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix.

3501


Do you know the use of 'auto' keyword?

662


Write a code to remove duplicates in a string.

629


what value is returned to operating system after program execution?

1606


#include main() { char s[] = "Bouquets and Brickbats"; printf(" %c, ",*(&s[2])); printf("%s, ",s+5); printf(" %s",s); printf(" %c",*(s+2)); }

666


How can I find out how much free space is available on disk?

629