Created
September 12, 2017 10:12
-
-
Save hyperion0201/cf54425537d351578a16b0198a42e6be to your computer and use it in GitHub Desktop.
Right Isosceles Triangle with Float Variables check in C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <math.h> | |
#include <stdlib.h> | |
void CheckSST(float a, float b, float c) { | |
float aceil = ceilf(a*a*10)/10; | |
float bceil = ceilf(b*b*10)/10; | |
float cceil = ceilf(c*c*10)/10; | |
if (a==b && ceilf((a*a+b*b)*10)/10 == cceil) { | |
printf("Passed !\n"); | |
} | |
else if (b==c && ceilf((b*b+c*c)*10)/10 == aceil) | |
{ | |
printf("Passed!\n"); | |
} | |
else if (a==c && ceilf((a*a+c*c)*10)/10 == bceil) | |
{ | |
printf("Passed\n"); | |
} | |
else { | |
printf("Not Passed !\n"); | |
} | |
} | |
int main() { | |
float a, b, c; | |
printf("Nhap a, b, c\n"); | |
scanf("%f", &a); | |
scanf("%f", &b); | |
scanf("%f", &c); | |
CheckSST(a, b, c); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment