Hello, I am a new member to this forum. I have some announcements, I will continue to read some more.
I need to create a program were the user inputs a number, program displays the cube root for that number.
The code I got thusfar is:
#include <stdio.h>
#include <math.h>
int main(void)
{int cube;
do
{
printf("Please type in the number you wish to cube root: \n");
scanf_s("%d" , &cube);
double result;
result= pow( cube, 1.0 / 3.0 );
printf ("The cube root is " "%5.4f\n",result);
printf ("\n");
}while (cube !=-10094556);
return 0;
The program works, but when I type in a integer, for example (-2) it shows -1.#IND.
I tried changing int cube to double cube; but then it displays -1.#QNB
I am trying to resolve the issue listed above.
Just a something extra someone could be generous to help me with;
when I place a decimal it either crashes or goes in an endless loop.
THe loop currently placed in the program listed above lets the program loop until the user places that value.
It is a simple loop, if anyone has a different way of looping the program I would greatly appreaciate it.
Thank you to all who are willing to help or have tried.
And hopefully I am not breaking any rules, as I have not finished reading the announcements. :D