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;
}









share|improve this question




















  • 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















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;
}









share|improve this question




















  • 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













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;
}









share|improve this question















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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 write if (A+B+C == triagolnik)
    – Sourav Ghosh
    Nov 22 at 14:47














  • 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








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












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");





share|improve this answer























  • 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











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















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

























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");





share|improve this answer























  • 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















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");





share|improve this answer























  • 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













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");





share|improve this answer














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");






share|improve this answer














share|improve this answer



share|improve this answer








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


















  • 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


















draft saved

draft discarded




















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Catalogne

Violoncelliste

Héron pourpré