-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWeek_11_2.c
52 lines (43 loc) · 1.69 KB
/
Week_11_2.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
* two.c
*
* Created on: Apr 9, 2021
* Author: Jeremy
*/
#include <stdio.h>
#include <math.h>
#define PI 3.14159265358979323846
int main()
{
float compression;
float areas, areaa, areac;
float dias, diaa, diac;
printf("what is the compression load you would like to calculate?\n"); fflush(stdout);
scanf("%f", &compression);
areas = compression / 25000;
dias = 100 * (2 * sqrt(areas / PI));
areaa = compression / 15000;
diaa = 100 * (2 * sqrt(areaa / PI));
areac = compression / 20000;
diac = 100 * (2 * sqrt(areac / PI));
if (compression > 15000 && compression <=20000) {
printf("The load entered exceeds the allowable compression of aluminum. This wont be calculated \n");
printf("Material:\tLoad:\t\tAllowable Stress:\tDiameter:\n");
printf("Steel:\t\t%.0f\t\t25,000\t\t\t%.2fcm\n", compression, dias);
printf("Copper:\t\t%.0f\t\t20,000\t\t\t%.2fcm\n", compression, diac);
}
else if (compression > 20000 && compression <=25000) {
printf("The load entered exceeds the allowable compression of aluminum and copper. These wont be calculated \n");
printf("Material:\tLoad:\t\tAllowable Stress:\tDiameter:\n");
printf("Steel:\t\t%.0f\t\t25,000\t\t\t%.2fcm\n", compression, dias);
}
else if (compression > 25000) {
printf("The load entered exceeds the allowable compression of steel, aluminum and copper. These wont be calculated \n");
}
else {
printf("Material:\tLoad:\t\tAllowable Stress:\tDiameter:\n");
printf("Steel:\t\t%.0f\t\t25,000\t\t\t%.2fcm\n", compression, dias);
printf("Aluminum:\t%.0f\t\t25,000\t\t\t%.2fcm\n", compression, diaa);
printf("Copper:\t\t%.0f\t\t20,000\t\t\t%.2fcm\n", compression, diac);
}
}