Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- __| |____________________________________________| |__
- (__ ____________________________________________ __)
- | | | |
- | | | |
- | | | |
- | | Excercice 1 | |
- | | | |
- | | | |
- __| |dc__________________________________________| |__
- (__ ____________________________________________ __)
- | | | |
- #include <stdio.h>
- #define EN_PARALLELE 1
- #define EN_SERIE 0
- int main() {
- float R1, R2, R3;
- int typeDeMontage;
- printf("Donner la valeur de R1 >>:");
- scanf("%f", &R1);
- printf("Donner la valeur de R2 >>:");
- scanf("%f", &R2);
- printf("Donner la valeur de R3 >>:");
- scanf("%f", &R3);
- printf("Quel est le type de montage utilise?\n");
- printf("0: Montage en serie\n");
- printf("1: Montage en parallele\n");
- do {
- printf(">>:");
- scanf("%d", &typeDeMontage);
- } while (typeDeMontage != 0 && typeDeMontage != 1);
- printf("La resistance equivalente est : ");
- if (typeDeMontage == EN_SERIE) {
- printf("%.3f", R1 + R2 + R3);
- } else if (typeDeMontage == EN_PARALLELE) {
- printf("%.3f", (R1 * R2 * R3) / (R1 * R2 + R1 * R3 + R2 * R3));
- }
- }
- ---------------------------------------------------------------------------------------
- | Exercice 2 |
- ---------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement