Skip to content

Instantly share code, notes, and snippets.

@hyperion0201
Created September 12, 2017 10:12
Show Gist options
  • Save hyperion0201/cf54425537d351578a16b0198a42e6be to your computer and use it in GitHub Desktop.
Save hyperion0201/cf54425537d351578a16b0198a42e6be to your computer and use it in GitHub Desktop.
Right Isosceles Triangle with Float Variables check in C
#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