# Adding 2 functions to a C Program

Hello,

I need to add two functions to this C Program here: https://onlinegdb.com/uqjIhF5AH

I am trying to do it, but can't get it to work. I want to add the following functions:

int main()
{
float celsius, fahrenheit;

printf("Please Enter the temperature in Fahrenheit: \n");
scanf("%f", &fahrenheit);

// Convert the temperature from f to c formula
celsius = (fahrenheit - 32) * 5 / 9;
//celsius = 5 *(fahrenheit - 32) / 9;
//celsius =(fahrenheit-32) * 0.55556;

printf("\n %.2f Fahrenheit = %.2f Celsius", fahrenheit, celsius);

return 0;
}

2nd Function:

```int main()
{
printf("\n Hello World");
return 0;
}```
`Thank you for the help.`
`Jon`

answered Nov 9, 2022 by (66,630 points)

You cannot have more than one main() function (actually, you cannot have more than 1 function with the same name) in a C program.

The main() function is the entry point of your application. Create new functions and put the functionality there. E.g.:

```int MyFunction1()
{
...
return 42;
}

void MyFunction2(int value)
{
...
}

int main()
{
int number = MyFunction1();
MyFunction2(number);
return 0;
}```
+1 vote
answered Nov 15, 2022 by (310 points)
/* C Program to Calculate Square, Square root, Triangle Perimeter and Grade Average */

#include<stdio.h>

#include<math.h>

int Calculate_Square (int Number);

float Calculate_Perimeter_Triangle (float a, float b, float c);

int

main ()

{

int number, Square;

float a, b, c, Triangle, Square_Root;

printf (" \n Please Enter any integer Value : ");

scanf ("%d", &number);

Square = Calculate_Square (number);

printf ("\n Square of a given number %d = %d\n", number, Square);

/* Square Root */

printf ("The square root of your number %d is %f\n", number, sqrt (number));

printf ("\nPlease Enter three sides of triangle\n");

scanf ("%f%f%f", &a, &b, &c);

/* Triangle */

Triangle = Calculate_Perimeter_Triangle (a, b, c);

printf ("Area of triangle is %f\n", Triangle);

return 0;

}

int

Calculate_Square (int Number)

{

return Number * Number;

}

float

Calculate_Perimeter_Triangle (float a, float b, float c)

{

float s, Perimeter;

Perimeter = a + b + c;

return Perimeter;

}

float

Calculate_Grade (float g1, float g2, float g3, float g4){

}