If the length of the sides of a triangle are denoted by a,b,c and then what is the area of the triangle by using pointer ?
In this program , we have to taking three input i,e sides of the triangles form the user and calculate the area of the triangle .
#include<stdio.h>
#include<conio.h>
void main()
{
float s=0,a,b,c,area=0;
float *x,*y,*z,*sum,*area1;
printf("enter the three number:-");
scanf("%f %f %f",&a,&b,&c);
x=&a,y=&b,z=&c,sum=&s,area1=&area;
s=(a+b+c)/2;
printf("\n the area of the triangle are follow");
area=sqrt(s*(s-a)*(s-b)*(s-c));
printf("\n the solution is %.2f",*area1);
getch();
}
#include<conio.h>
void main()
{
float s=0,a,b,c,area=0;
float *x,*y,*z,*sum,*area1;
printf("enter the three number:-");
scanf("%f %f %f",&a,&b,&c);
x=&a,y=&b,z=&c,sum=&s,area1=&area;
s=(a+b+c)/2;
printf("\n the area of the triangle are follow");
area=sqrt(s*(s-a)*(s-b)*(s-c));
printf("\n the solution is %.2f",*area1);
getch();
}
output :-
For more c-programming:-

No comments:
Post a Comment