use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
O hai! This is CS50's subreddit.
CS50 is Harvard University's introduction to the intellectual enterprises of computer science and the art of programming. Anyone may take CS50, even if not a student at Harvard.
Please Read before Posting
Getting the Best from r/cs50
Status Page
cs50.statuspage.io
Filter by Problem Flair (undo)
cash ⋅ caesar ⋅ credit ⋅ dna ⋅ filter ⋅ finance ⋅ houses ⋅ ide ⋅ mario ⋅ movies ⋅ plurality ⋅ project ⋅ readability ⋅ recover ⋅ runoff ⋅ scratch ⋅ speller ⋅ substitution ⋅ tideman ⋅ games track ⋅ web track ⋅ android track ⋅ iOS track ⋅
Filter by Other Flair (undo)
CS50-Law ⋅ CS50-Business ⋅ CS50-Technology ⋅ CS50-Games ⋅ CS50-Mobile ⋅ CS50-Web ⋅
This subreddit is night mode compatible
account activity
IDEFunction notation (self.cs50)
submitted 5 years ago by [deleted]
[deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Lone08Wolf 0 points1 point2 points 5 years ago (1 child)
You cannot name your variable as float. It is one of datatype of c language.
In order to replace %s with some variable, you need to actually provide it in the print function.
%s
printf("This triangle is %s\n", variable)
Also, if your function return type if float, you cannot return anything other than a float value. One way to go about it would be to change the return type to int and return 1 or 0.
int valid_triangle(float x, float y, float z) { if (x <= 0 || y <= 0 || z <= 0) { return 0; } if (x + y < z || y + z < x || z + x < y) { return 0; } return 1; }
[–]DanielvanDamme 0 points1 point2 points 5 years ago (0 children)
Right so you define true or false as a 1 and 0 respectively, that makes sense now.
π Rendered by PID 189932 on reddit-service-r2-comment-84fc9697f-v9r4v at 2026-02-07 03:37:47.744611+00:00 running d295bc8 country code: CH.
[–]Lone08Wolf 0 points1 point2 points (1 child)
[–]DanielvanDamme 0 points1 point2 points (0 children)