You should learn to use functions. A function is called from main and it can be passed arguements. The function requires a definition and should have a prototype.
Code:
//return type - function name - parameters
void MyFunction(int,double); //prototype
int main()
{
int num;
double price;
scanf("%d %lf", &num, &price);
//num and price are arguements to the function call
MyFunction(num,price); //function call
return 0;
}
//function definition
void MyFunction(int num, double price)
{
//num and price are the function parameters
//calculate charge
double charge = num * price;
printf("Charge is: ",charge);
}
Although just a useless function, this is a demonstration of the syntax. This function passes the arguements num and price by value, therefore copies of these arguements are created an placed in the function parameters of the same name.