Skip to content

Instantly share code, notes, and snippets.

@jetnew
Last active April 30, 2017 14:40
Show Gist options
  • Save jetnew/6911ea4417820f7fce47edc3b02a987c to your computer and use it in GitHub Desktop.
Save jetnew/6911ea4417820f7fce47edc3b02a987c to your computer and use it in GitHub Desktop.
To check for right angled triangle
#include <stdio.h>
#include <cs50.h>
int main(void)
{
//declare function to check validity of right angled triangle
bool valid_righttriangle(float x, float y, float z)
{
//to check using Pythagoras' Theorem
if (x*x + y*y = z*z) || (x*x + z*z = y*y) || (y*y + z*z = x*x)
{
return true
}
return false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment