Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

closed I don't know whether it's Ok or not)

0 votes
asked Dec 9, 2020 by Natalia (1,080 points)
closed Dec 11, 2020 by Natalia

Good evening!smiley
I'm learning how to create functions.cool
This is my code. I don't know if I wrote the arcsinus formula rightyesno.  I underlined it for you. Thanks in advancemail

#include <stdio.h>
#include <math.h>
float arcsinus(float);
int main()
    float z, y, Q, k; 
    printf("Уведіть Z\t");
    scanf("%f", &z);
    printf("\nУведіть Y\t");
    scanf("%f", &y);
      printf("\nУведіть інші значення");
      else if(((z>-1)&&(z<1))&&((y>-1)&&(y<1))){ 
    return 0;
float arcsinus(float X){
    float sum=X;
    for(float n=1;n<12;n++)
return sum;

closed with the note: I already know why

2 Answers

+1 vote
answered Dec 9, 2020 by Tom Stevens - TWCC - (230 points)

Hi there.

The program runs and compiles fine, could you state some test variables and their expected outcome please?

From what I gather, z and y must be within the range of -1 to +1 to give the resultant Q, else the message

"Уведіть інші значення" is displayed, which I assume means 'out of range'.

commented Dec 11, 2020 by Natalia (1,080 points)
Yes the program runs fine. I've already solved the problem. Thanks for attention!
+1 vote
answered Dec 10, 2020 by LiOS (6,420 points)
edited Dec 10, 2020 by LiOS
Do you mean arcsin formula? Searching arcsinus formula recommends arcsin. If so, include the math.h header file and use the asin() function.

I'm not too sure on the official formula, but if you're not allowed to use pre-built functions, you could perhaps input a number and see whether your formula and the asin() function result in the same answer.

commented Dec 10, 2020 by Natalia (1,080 points)
I know that I can add the math.h library to use the asin function but I'm trying to creat my own function.
commented Dec 11, 2020 by LiOS (6,420 points)
If the asin() function is what you want but want to re-create it yourself in a function... you could compare the answer of using the asin function vs your code. If the answer isn't the same, your function isn't correct.
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.