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

Answers were Sorted based on User's Feedback



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

Answer / 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

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

Answer / 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

More C Interview Questions

Do array subscripts always start with zero?

0 Answers  


count = 0; for (i = 1;i < = 10; i++);count = count + i; Value of count after execution of the above statements will be a) 0 b) 11 c) 55 d) array

0 Answers  


What is the value of a[3] if integer a[] = {5,4,3,2,1}?

0 Answers  


The performance of an operation in several steps with each step using the output of the preceding step a) recursion b) search c) call by value d) call by reference

0 Answers  


What are the types of operators in c?

0 Answers  






How is a structure member accessed?

0 Answers  


int x=sizeof(!5.856); What will value of variable x?

2 Answers  


write a reverse string to print a stars.(with out using logic) ***** **** *** ** *

2 Answers  


f=(x>y)?x:y a) f points to max of x and y b) f points to min of x and y c)error

4 Answers   HCL,


"C" language developed by "Dennis Ritchie" at AT & T. his remarks are a) too general, too abstract b) could deal with only specific problems c) lost generality of BCPL and B restored d) no remarks

0 Answers  


How can I trap or ignore keyboard interrupts like control-c?

0 Answers  


How would you find a cycle in a linked list?

3 Answers   NSN,


Categories