i have a triangle and i need to count a + b + c
up vote
-2
down vote
favorite
How do i write this line correctly?
if(a + b + c = 180)
This is my code. I need to do a + b + c in the if-statement:
#include <stdio.h>
int main()
{
int A;
int B;
int C;
int triagolnik = 180;
scanf("%d %d %d", &A, &B, &C);
if (A + B + C = triagolnik)
printf("DAn");
if (A, B, C = 80) // I want to make a + b + c = 80 but i don't know the right line
printf("PRAVOAGOLEN");
return 0;
}
c
add a comment |
up vote
-2
down vote
favorite
How do i write this line correctly?
if(a + b + c = 180)
This is my code. I need to do a + b + c in the if-statement:
#include <stdio.h>
int main()
{
int A;
int B;
int C;
int triagolnik = 180;
scanf("%d %d %d", &A, &B, &C);
if (A + B + C = triagolnik)
printf("DAn");
if (A, B, C = 80) // I want to make a + b + c = 80 but i don't know the right line
printf("PRAVOAGOLEN");
return 0;
}
c
2
=assigns,==compares.
– mch
Nov 22 at 14:46
4
SO is not a replacement for reading the first chapters of a C programming book.
– Lundin
Nov 22 at 14:47
1
You mean to writeif (A+B+C == triagolnik)
– Sourav Ghosh
Nov 22 at 14:47
add a comment |
up vote
-2
down vote
favorite
up vote
-2
down vote
favorite
How do i write this line correctly?
if(a + b + c = 180)
This is my code. I need to do a + b + c in the if-statement:
#include <stdio.h>
int main()
{
int A;
int B;
int C;
int triagolnik = 180;
scanf("%d %d %d", &A, &B, &C);
if (A + B + C = triagolnik)
printf("DAn");
if (A, B, C = 80) // I want to make a + b + c = 80 but i don't know the right line
printf("PRAVOAGOLEN");
return 0;
}
c
How do i write this line correctly?
if(a + b + c = 180)
This is my code. I need to do a + b + c in the if-statement:
#include <stdio.h>
int main()
{
int A;
int B;
int C;
int triagolnik = 180;
scanf("%d %d %d", &A, &B, &C);
if (A + B + C = triagolnik)
printf("DAn");
if (A, B, C = 80) // I want to make a + b + c = 80 but i don't know the right line
printf("PRAVOAGOLEN");
return 0;
}
c
c
edited Nov 22 at 14:50
Swordfish
1
1
asked Nov 22 at 14:44
Riste Petrusevski
81
81
2
=assigns,==compares.
– mch
Nov 22 at 14:46
4
SO is not a replacement for reading the first chapters of a C programming book.
– Lundin
Nov 22 at 14:47
1
You mean to writeif (A+B+C == triagolnik)
– Sourav Ghosh
Nov 22 at 14:47
add a comment |
2
=assigns,==compares.
– mch
Nov 22 at 14:46
4
SO is not a replacement for reading the first chapters of a C programming book.
– Lundin
Nov 22 at 14:47
1
You mean to writeif (A+B+C == triagolnik)
– Sourav Ghosh
Nov 22 at 14:47
2
2
= assigns, == compares.– mch
Nov 22 at 14:46
= assigns, == compares.– mch
Nov 22 at 14:46
4
4
SO is not a replacement for reading the first chapters of a C programming book.
– Lundin
Nov 22 at 14:47
SO is not a replacement for reading the first chapters of a C programming book.
– Lundin
Nov 22 at 14:47
1
1
You mean to write
if (A+B+C == triagolnik)– Sourav Ghosh
Nov 22 at 14:47
You mean to write
if (A+B+C == triagolnik)– Sourav Ghosh
Nov 22 at 14:47
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
As other people suggested you should be using == to compare, = is used to assign values to variables. As it seems to me, A, B and C are angles and the first check that you do is that you check if it is the case of valid triangle. If that's the case simply apply the suggested modification:
if (A + B + C == triagolnik)
printf("DAn");
In the second check, thanks to the same language, I seem to understand that you want to check whether the triangle is right one. If that's the case I don't see why you are mentioning the number 80, as the correct one should be 90. The correct check for right triangle would be:
if (A + B + C == triagolnik && (A == 90 || B == 90 || C == 90))
printf("PRAVOAGOLENn");
Thank you i did my exercise
– Riste Petrusevski
Nov 22 at 15:21
I put 80 by a mistake
– Riste Petrusevski
Nov 22 at 15:22
Fala ti se ucam sega c pocnav pa poleka poleka :D
– Riste Petrusevski
Nov 22 at 15:31
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
As other people suggested you should be using == to compare, = is used to assign values to variables. As it seems to me, A, B and C are angles and the first check that you do is that you check if it is the case of valid triangle. If that's the case simply apply the suggested modification:
if (A + B + C == triagolnik)
printf("DAn");
In the second check, thanks to the same language, I seem to understand that you want to check whether the triangle is right one. If that's the case I don't see why you are mentioning the number 80, as the correct one should be 90. The correct check for right triangle would be:
if (A + B + C == triagolnik && (A == 90 || B == 90 || C == 90))
printf("PRAVOAGOLENn");
Thank you i did my exercise
– Riste Petrusevski
Nov 22 at 15:21
I put 80 by a mistake
– Riste Petrusevski
Nov 22 at 15:22
Fala ti se ucam sega c pocnav pa poleka poleka :D
– Riste Petrusevski
Nov 22 at 15:31
add a comment |
up vote
0
down vote
accepted
As other people suggested you should be using == to compare, = is used to assign values to variables. As it seems to me, A, B and C are angles and the first check that you do is that you check if it is the case of valid triangle. If that's the case simply apply the suggested modification:
if (A + B + C == triagolnik)
printf("DAn");
In the second check, thanks to the same language, I seem to understand that you want to check whether the triangle is right one. If that's the case I don't see why you are mentioning the number 80, as the correct one should be 90. The correct check for right triangle would be:
if (A + B + C == triagolnik && (A == 90 || B == 90 || C == 90))
printf("PRAVOAGOLENn");
Thank you i did my exercise
– Riste Petrusevski
Nov 22 at 15:21
I put 80 by a mistake
– Riste Petrusevski
Nov 22 at 15:22
Fala ti se ucam sega c pocnav pa poleka poleka :D
– Riste Petrusevski
Nov 22 at 15:31
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
As other people suggested you should be using == to compare, = is used to assign values to variables. As it seems to me, A, B and C are angles and the first check that you do is that you check if it is the case of valid triangle. If that's the case simply apply the suggested modification:
if (A + B + C == triagolnik)
printf("DAn");
In the second check, thanks to the same language, I seem to understand that you want to check whether the triangle is right one. If that's the case I don't see why you are mentioning the number 80, as the correct one should be 90. The correct check for right triangle would be:
if (A + B + C == triagolnik && (A == 90 || B == 90 || C == 90))
printf("PRAVOAGOLENn");
As other people suggested you should be using == to compare, = is used to assign values to variables. As it seems to me, A, B and C are angles and the first check that you do is that you check if it is the case of valid triangle. If that's the case simply apply the suggested modification:
if (A + B + C == triagolnik)
printf("DAn");
In the second check, thanks to the same language, I seem to understand that you want to check whether the triangle is right one. If that's the case I don't see why you are mentioning the number 80, as the correct one should be 90. The correct check for right triangle would be:
if (A + B + C == triagolnik && (A == 90 || B == 90 || C == 90))
printf("PRAVOAGOLENn");
edited Nov 22 at 15:23
answered Nov 22 at 14:53
NiVeR
6,77141930
6,77141930
Thank you i did my exercise
– Riste Petrusevski
Nov 22 at 15:21
I put 80 by a mistake
– Riste Petrusevski
Nov 22 at 15:22
Fala ti se ucam sega c pocnav pa poleka poleka :D
– Riste Petrusevski
Nov 22 at 15:31
add a comment |
Thank you i did my exercise
– Riste Petrusevski
Nov 22 at 15:21
I put 80 by a mistake
– Riste Petrusevski
Nov 22 at 15:22
Fala ti se ucam sega c pocnav pa poleka poleka :D
– Riste Petrusevski
Nov 22 at 15:31
Thank you i did my exercise
– Riste Petrusevski
Nov 22 at 15:21
Thank you i did my exercise
– Riste Petrusevski
Nov 22 at 15:21
I put 80 by a mistake
– Riste Petrusevski
Nov 22 at 15:22
I put 80 by a mistake
– Riste Petrusevski
Nov 22 at 15:22
Fala ti se ucam sega c pocnav pa poleka poleka :D
– Riste Petrusevski
Nov 22 at 15:31
Fala ti se ucam sega c pocnav pa poleka poleka :D
– Riste Petrusevski
Nov 22 at 15:31
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53433366%2fi-have-a-triangle-and-i-need-to-count-a-b-c%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
=assigns,==compares.– mch
Nov 22 at 14:46
4
SO is not a replacement for reading the first chapters of a C programming book.
– Lundin
Nov 22 at 14:47
1
You mean to write
if (A+B+C == triagolnik)– Sourav Ghosh
Nov 22 at 14:47