-1.#IND00 관련 질문
초코우유
질문 제목 : -1.#ind00 관련 질문코딩시 -1.#ind00가 뜹니다.질문 내용 :안녕하세요.2개의 변의 길이와 그 끼인각을 입력시키고 나머지 각들과 변의 길이를 cos법칙을 이용하여 구하는 코딩을 하던중에2개의 각이 acos()으로 계산되게 되엇는데 값이 -1.#ind00이 뜹니다.도와주세요 ㅠㅠ#includestdio.h
#includemath.hfloat l1, l2, a1;
double a2, a3;//gather the length of two sides of a triangle as well as the angle between them.
float inputs();//output the third length
float thirdside(float l1, float l2, float a1);//output the other two angles
double otherangle2(float l1, float l2, float l3);
double otherangle3(float l1, float l2, float l3);//output the type of triangle
void type(float a1, double a2, double a3);main()
{
float l3; //get input data
inputs(); //get the length of third side
l3 = thirdside(l1, l2, a1); //get the other two angles
a2 = otherangle2(l1, l2, l3);
a3 = otherangle3(l1, l2, l3); //get the type of the triangle
type(a1, a2, a3);
}///////////////////////////////////////////////////float inputs()
{
printf(enter the length of two sides and the angle between them.\n);
scanf(%f%f%f, &l1, &l2, &a1);
printf(inputs : l1=%f, l2=%f, a1=%f.\n, l1, l2, a1);
}//////////////////////////////////////////////////////////////////////////float thirdside(float l1, float l2, float a1)
{
float l3;
if(a1 == 90)
{
l3 = sqrt(l1*l1 + l2*l2);
printf(the length of the third side is %f\n, l3);
} else
{
l3 = sqrt(l1*l1 + l2*l2 -2*l1*l2*cos(a1));
printf(the length of the third side is %f\n, l3);
} return l3;
}///////////////////////////////////////////////////////////////////////////double otherangle2(float l1, float l2, float l3)
{
a2 = acos( (l2*l2 + l3*l3 - l1*l1) / 2*l2*l3 );
printf(the other two angle2 is %lf.\n, a2); return a2;
}/////////////////////////////////////////////////////////////////////////// double otherangle3(float l1, float l2, float l3)
{
a3 = acos( (l1*l1 + l3*l3 - l2*l2) / 2*l1*l3 ); printf(the other two angle3 is %lf.\n, a3);
return a3;
}/////////////////////////////////////////////////////////////////////////// void type(float a1, double a2, double a3)
{
if(a1 =if(a1 == 90 || a2 == 90 || a3 == 90)
{
printf(this triangle is right triangle.\n);
} else if(a1 90 && a2 90 && a3 90)
{
printf(this triangle is acute triangle.\n);
} else
{
printf(this triangle is obtuse triangle.\n);
}
}감사합니다!
번호 | 제 목 | 글쓴이 | 날짜 |
---|---|---|---|
2700695 | 간단한 메모장 구현을 할려고 하는데요 (9) | 늘솜 | 2025-07-07 |
2700668 | c언어 질문입니다. 도와주세요~ (3) | 가자 | 2025-07-07 |
2700639 | 한글입력받아서 ㄱㄴㄷ순서대로출력하는법좀 | 두빛나래 | 2025-07-06 |
2700610 | 정말 기초적인 더하기,여백 문제 help | 무슬 | 2025-07-06 |
2700562 | 함수포인터에서요 (7) | 소심한여자 | 2025-07-06 |
2700530 | 전처리문 질문입니다. (1) | 아놀드 | 2025-07-05 |
2700510 | c언어를 어케하면 잘할수 있을까요.. | 연연두 | 2025-07-05 |
2700484 | 두 개가 차이가 뭔지 알려주세요...(소수 찾는 프로그램) (2) | 날위해 | 2025-07-05 |
2700426 | 인터넷 창 띄우는 질문이요 (1) | 정훈 | 2025-07-04 |
2700400 | 원넓이를 계산이요 ㅜㅜ | 천칭자리 | 2025-07-04 |
2700368 | if에 관해서 질문이요... | Orange | 2025-07-04 |
2700339 | 이거 결과값이 왜이런건지.. (4) | 그댸와나 | 2025-07-04 |
2700313 | 파일 읽어서 저장하는데 빈파일일 경우 문재가 발생하네요.. (2) | 크나 | 2025-07-03 |
2700287 | 구조체 동적할당 연습을 하는데 오류가 뜹니다...(해결) (3) | 아련나래 | 2025-07-03 |
2700264 | 문자와 숫자 동시에 입력??? | 글고운 | 2025-07-03 |
2700236 | txt파일로만 쓰고 읽게 하려면 어떻게 해야 하나요..?? (8) | 미국녀 | 2025-07-03 |
2700211 | 전위 연산자 (2) | 어른처럼 | 2025-07-02 |
2700183 | C에서 파일이름을 받고, 그 파일의 사이즈를 출력해줘야하는데 내용이 출력이 안되네요 ;ㅅ; | 피스케스 | 2025-07-02 |
2700150 | 꼭좀 도와주세요ㅠㅠㅠ | 호습다 | 2025-07-02 |
2700095 | 연산문제...질문... | 오빤테앵겨 | 2025-07-01 |