I don't know how to describe user function definitions

Asked 2 years ago, Updated 2 years ago, 33 views

I'd like to find a triple value by adding 5 to the number I entered in the user function practice, but I don't know what to write in the calc part.I would appreciate it if you could tell me.
You can only change the calc()//description.

#include<stdio.h>
# include <math.h>

calc()// Description

int main()
{
    int x, y;
    scanf("%d", & x);
    y = calc(x);
    printf("Answer=%d",y);
    return(0);
}

c

2022-09-30 14:46

3 Answers

It may be easy to get an answer, but it is not good for the questioner.I recommend that you study hard from the basics.

// First, just how to write a function
int calc(intx){
    Return x;//x as it is.Let's think about the four rules by ourselves.
}


2022-09-30 14:46

Here is an example answer.I think the reference site will be helpful.

Reference site: https://www.sejuku.net/blog/24348

int calc(intx)
{
    return(x+5)*3;
}


2022-09-30 14:46

You will find pages like Introduction to C language by searching for keywords such as "C language""Introduction""Beginner"

Using Google and other search sites is the most basic network literacy.


2022-09-30 14:46

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.