ANSI C
#include <math.h> double third_angle ( double first_angle , double second_angle ) { first_angle = fmod( first_angle , 360.0 ); // Get absolute second_angle = fmod( second_angle , 360.0 ); if ( first_angle + second_angle >= 180 ) return 0.0; // That's not a triangle! OwO return ( 180 - first_angle - second_angle ); } int main ( int argc , char ** argv ) { if ( ( int ) third_angle( 30 , 60 ) == 90 && ( int ) third_angle( 60 , 60 ) == 60 && ( int ) third_angle( 43 , 78 ) == 59 && ( int ) third_angle( 10 , 20 ) == 150 ) return 0; // It works! return 101; // Or not }
Run with ~$ gcc -lm <file_name> && ./a.out
~$ gcc -lm <file_name> && ./a.out
Kept it simple
#include <stdio.h> int other_angle(int a, int b) { return(180 - a - b); }
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
ANSI C
Run with
~$ gcc -lm <file_name> && ./a.outKept it simple