forked from swaaz/basicprograms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogram.c
More file actions
29 lines (19 loc) · 677 Bytes
/
Copy pathprogram.c
File metadata and controls
29 lines (19 loc) · 677 Bytes
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
/*program to calculate profit & loss in BITCOIN mining*/
#include<stdio.h>
int main(){
float current_btc_price, avg_cost;
float total_btc, profitloss;
printf("Enter Your Total Bitcoin: ");
scanf("%f",&total_btc);
printf("Enter Current Bitcoin Price: ");
scanf("%f",¤t_btc_price);
printf("Your Average Bitcoin Purchase Price: ");
scanf("%f",&avg_cost);
//profitloss = (current_btc_price - averagecost) x total_btc
profitloss = (current_btc_price - avg_cost) * total_btc;
if(profitloss > 0)
printf("Bitcoin Trading Profit is: %0.2f",profitloss);
else
printf("Bitcoin Trading Loss is: %0.2f",profitloss);
return 0;
}