-
-
Save jurnalanas/3787764 to your computer and use it in GitHub Desktop.
Nomor 13 dan 14
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
// WARNING! | |
// source code ini untuk membantu belajar ya.. | |
// buat yang udah nyoba dan belum accepted, ini bisa buat belajar, | |
// tapi yang belum nyoba, jangan liat kodingan ini, coba latihan dulu, OK?! ini hanya contoh kodenya, jadi ada cara lain yg | |
// lebih cepet, nah.. cari coba deh dicari cara yang lebih efisien.. ^_^ | |
// Nomor 13 | |
#include <stdio.h> | |
int main() { | |
double a, b, c, d,e; | |
scanf("%lf%lf%lf%lf", &a, &b, &c, &d); | |
e=((a*0.35)+(b*0.35)+(c*0.25)+(d*0.05)); | |
if (e>=75) { | |
printf("A\n"); | |
} else if ((e>=70)&&(e<75)) { | |
printf("AB\n"); | |
} else if ((e>=60)&&(e<70)) { | |
printf("B\n"); | |
} else if ((e>=50)&&(e<60)) { | |
printf("BC\n"); | |
} else if ((e>=40)&&(e<50)) { | |
printf("C\n"); | |
}else if ((e>=20)&&(e<40)) { | |
printf("D\n"); | |
} else if ((e>=0)&&(e<20)) { | |
printf("E\n"); | |
} | |
return 0; | |
} | |
// Nomor 14 | |
#include <stdio.h> | |
int main() { | |
long int a, b, c; | |
scanf("%ld%ld%ld", &a, &b,&c); | |
if ((a==b)&&(b==c)&&(a==c)) { | |
printf("Segitiga sama-sisi\n"); | |
} else if ((a==b)&&(c>90)) { | |
printf("Segitiga tumpul samakaki\n"); | |
} else if ((a==c)&&(b>90)) { | |
printf("Segitiga tumpul sama-kaki\n"); | |
} else if ((a>90)&&(b==c)) { | |
printf("Segitiga tumpul sama-kaki\n"); | |
} else if ((a==b)&&(c<90)) { | |
printf("Segitiga lancip sama-kaki\n"); | |
} else if ((b==c)&&(a<90)) { | |
printf("Segitiga lancip sama-kaki\n"); | |
} else if ((b<90)&&(a==c)) { | |
printf("Segitiga lancip sama-kaki\n"); | |
} else if ((a<90)&&(b<90)&&(c<90)) { | |
printf("Segitiga lancip\n"); | |
} else if ((a==90)&&(b==c)) { | |
printf("Segitiga siku-siku sama-kaki\n"); | |
} else if ((b==90)&&(a==c)) { | |
printf("Segitiga siku-siku sama-kaki\n"); | |
} else if ((c==90)&&(a==b)) { | |
printf("Segitiga siku-siku sama-kaki\n"); | |
} else if ((a==90)) { | |
printf("Segitiga siku-siku\n"); | |
} else if ((b==90)) { | |
printf("Segitiga siku-siku\n"); | |
} else if ((c==90)) { | |
printf("Segitiga siku-siku\n"); | |
} else if ((a>90)) { | |
printf("Segitiga tumpul\n"); | |
} else if ((b>90)) { | |
printf("Segitiga tumpul\n"); | |
} else if ((c>90)) { | |
printf("Segitiga tumpul\n"); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment