1. ## functions problem (help)

i am trying to training my self to use functions and i start with easy tasks but i though that this task will work but the output is not show any result any idea why ?   my code

Code:
```#include<stdio.h>
#include<math.h>
#define PI 3.14
double length_third_side (double n1,double n2,double tr);
double calculateArea(double s,double n1,double n2, double n3 );

int main ()
{

double n1,n2,n3,r,t,tr,s,a;
printf("Enter the length of side 1 [cm] :\n" );
scanf("%lf",&n1);
printf("Enter the length of side 2 [cm] :\n");
scanf("%lf",&n2);
printf("Enter the angel in degrees bettween side1 and side 2:");
scanf("%lf",&t);
n3= length_third_side (n1,n2,tr);
s=(n1+n2+n2)/2.0;
a= calculateArea(s,n1,n2,n3);

printf ("The area of the triangle = %.2lf ",a);
return 0;

}

double tr ;

tr = t*PI/180.0;
return tr;
}
double length_third_side (double n1,double n2,double tr){
double n3;
n3 =n1*n1*n2*n2-(2*n1*n2*cos(tr));
return n3;
}
double calculateArea(double s,double n1,double n2, double n3 ){
double a;
a=sqrt(s*(s-n3)*(s-n1)*(s-n2));
return a ;

}``` 2. Presumably s should involve n1, n2, and n3, rather than n1, n2, and n2. 3. i fixed it but till the same

---------- turned out that the problem is i define a^2 not a so i just need to put a sqrt  4. I can only assume where the mistake is in your program.
The function deg_to_radians is not correct, the formula is:
((2 * PI) / 360) * winkel.
For the computation of the third side you should use the pow-function -- maybe is there also a mistake in the program.

This program run correct:

Code:
```#include <stdlib.h>
#include <stdio.h>
#include <math.h>

#define PI 3.14159

//Deklaration
double dreieck_dritte_seite(double a, double b, double radiant);
double flaeche_dreieck(double a, double b, double c);

int main(void)
{
double a, b, winkel;

system("cls");
printf("\nBerechnung des Flaecheninhalts eines beliebigen Dreiecks\n\n");

printf("Geben Sie die Laenge des Dreiecks von Seite a ein: ");
scanf("%lf", &a);
printf("Geben Sie die Laenge des Dreiecks von Seite b ein: ");
scanf("%lf", &b);
printf("Geben Sie den Winkel zwischen a und b ein        : ");
scanf("%lf", &winkel);

printf("\nDie Laenge von Seite c betraegt  : %6.2lf cm", dreieck_dritte_seite(a, b, gradmass_in_bogenmass(winkel)));
printf("\nDie Flaeche des Dreiecks betraegt: %6.2lf qcm\n", flaeche_dreieck(a, b,

return(0);
}

{

}

double dreieck_dritte_seite(double a, double b, double radiant)
{
double y = 2.0;  //Hilfsvariable
double seite_c;

seite_c = sqrt((pow(a, y) + pow(b, y)) - (2 * a * b * cos(radiant)));
return seite_c;
}

double flaeche_dreieck(double a, double b, double c)
{
double S, flaeche;

S = ((a + b + c) / 2);
flaeche = sqrt((S * ((S - a) * (S - b) * (S - c))));
return flaeche;
}```  Popular pages Recent additions deg_to_radians, double, length_third_side, return 